I have a program that I am wrote and i want to assign each element in the array the same value as the index. For some reason it will not work and I am not sure why. Here is a snippet of the for loop going through the array of 6 ints and the return.
I already declared the variable i and intitialized it what is wrong?
I already declared the variable i and intitialized it what is wrong?
int[] arrayOfIndexes = new int[5];
for(int i = 0; i < 6; i++) {
arrayOfIndexes[i] = i;
}
return i;