Use array element as trailing for loop

Please explain this loop:

for(p=0;p<a[j];p++)

I'm new and I'm confused how such cycles work?

Please pay attention to using a loop a[j]in a loop.

+5
source share
2 answers

a[j] for, a[j] , a[j] integer ( long), 't , ). , a[j] ( j) . , p a[j], . . a[j] , for . , break return.

+7

, , , .

a , int, j - int. , , , :

int j = 5; // for example
int[] a = new int[10]; // An array of 10 ints
a[5] = 3; // somewhere, the jth element of a should have been assigned

a[j] - 3, , :

for (p=0; p<3; p++)

, "", , a[5] , 3

nitpickers: "int" java.

+1

All Articles