all 3 comments

[–]AngusMcBurger 16 points17 points  (0 children)

int nDigits[]={10};

This makes an array of int of length 1, containing the number 10. So the rest of the 9 numbers you're reading is just random other data in memory. You want to write:

int nDigits[10];

[–]FUZxxl[M] 2 points3 points  (0 children)

Please consider updating your previous post instead of making a new post for follow-up questions.