justanotherkid Posted April 5, 2016 Posted April 5, 2016 [/img]https://gyazo.com/43714ea3d5bc397137be1f455c3f4a6e[/img] could someone explain what array (as in how value is found; is it the sum of elements in i?) and wtf is array[ind] if it wasn't declared earlier thx guys
Vilius Posted April 5, 2016 Posted April 5, 2016 "ind" is your indice number, the array[ i ], i means the position in the array which accompanies an element in the array. Say you have: int array[] = { 9, 8, 7, 6}; and then you type array[0] it will return the number 9 in the array list. Maybe this will help you visualize easier:
Isolate Posted April 5, 2016 Posted April 5, 2016 (edited) for(int i = 0; i < arrays.length; i++){ //Here is where I mean } Creates a loop that'll keep looping whilst the value of i is less than the length of the Array arrays. In this case you're declaring a loop that initialises a value of i that starts at zero. i++ means after each loop it'll increase the value of i by 1. in the case of array, i is the index in the array defined above. so on the first loop array would be 1, on the second loop 23, ect. Although I have no idea what ind is or what kind of tutorials you're following. Maybe someone else can clear that up Oh I didn't read the full thing 0.0 I see why it has heaps of underscores now xD Edited April 5, 2016 by Isolate
justanotherkid Posted April 5, 2016 Author Posted April 5, 2016 (edited) thanks guys, i understand it now but why would they put array[ind] instead of int[ind] seeing as it is only holding one value right? nvm i get it, it records the index number Edited April 5, 2016 by justanotherkid