Calculating the sum of integers in an array

后端 未结 9 1507
我在风中等你
我在风中等你 2021-01-19 03:11

I don\'t know if I\'m just being a total fool, most likely I am, it\'s been a long day, but this isn\'t working as I want it to, and, well, I don\'t see why.

It sho

9条回答
  •  礼貌的吻别
    2021-01-19 04:07

    My guess is buffer over-run since the for-loop reads in 11 numbers and the 11th number gets stored outside the array, probably overwriting i.

    Try changing the 11 to a 10 in the for loop.

提交回复
热议问题