You are setting volts[0] to be equal to volts[10] in your calc_volts function. What you may want to do instead is to make your calc_volts function of type void, not return anything, and replace your line 22 with the following: