+ 4

still finding it difficult with the arrays in loops. Guess it wasn't explained better

5th Aug 2016, 11:47 AM
Baba Yunus Abdul Yekin
Baba Yunus Abdul Yekin - avatar
3 Respostas
+ 3
Lets take the example given by this app. int myarray[5]; this line creates the array which is of dimension 5,which means it stores 5 values. for(x=0;x<5;x++) { myarray[x] = 42; } Ok. The index is the position an element has in an array. You know the first index is 0 and so the last one Is 4. We need a variable to store these values,thats why x was created,starting with value 0 to get the value of index 0. Now the for loop.Since 0<5 ,the loop will access the array's index 0 and set the value to 42. 1<5 -> index 1 -> value42 and so on..
5th Aug 2016, 1:44 PM
Vlad Cranga
Vlad Cranga - avatar
+ 2
look up other sources and learn from there, searching "Array Tutorial C++" in any search engine should bring up useful results
5th Aug 2016, 12:07 PM
Null Void
Null Void - avatar
+ 2
thanks guys. I'm getting much better now
6th Aug 2016, 10:41 AM
Baba Yunus Abdul Yekin
Baba Yunus Abdul Yekin - avatar