0
Loop variable? Do you mean the number between the square brackets? Those are used to represent (counting from zero) the number of values it will hold. For example: int myArray[2] = {1, 5, 2}; // Arrays start counting from zero If you're talking about looping through an array, you can do the following to get the length of the array: myArray.length(); // Which is 2 EDIT: Arrays don't have to be initialized with a number between brackets if you give it's value. For example: int mySecondVar[] = {12, 234, 2, 5}; // Automatically assumes array size of 3 int myThirdVar[4]; // It knows the length, but hasn't been assigned a value. OKAY. int myFourthVar[]; // Error!
23rd Mar 2017, 4:20 AM
Luke Wilson
Luke Wilson - avatar