0

This codedont work

i practicing code and the thing out put 0? and skiped alot of numbers i need 2 know, also i dont understand for loops can some explain to be in other words txx. https://code.sololearn.com/cIJH6EYX57dK/?ref=app https://code.sololearn.com/cIJH6EYX57dK/?ref=app

4th Jan 2018, 3:03 PM
Lord Awesome
Lord Awesome - avatar
2 Réponses
+ 1
Check your code again. You declared an array of size 8. So the for loop should run 8 times (not 70 times) to initialize all the values in the array, like this for(int x=0; x<8; x++){ myArr[x] = 42; cout<<x<<" : "<<myArr[x]<<endl; } You are using your for loop from 0 to 70, therefore in the output, after 7 subscript, system is printing just garbage!
4th Jan 2018, 3:21 PM
Harjeet Singh
Harjeet Singh - avatar
0
ooohhh ok thanks
4th Jan 2018, 3:35 PM
Lord Awesome
Lord Awesome - avatar