until now, i have always thought that size of a 2D array means..
A[3][4] = 12 cells
but i came across this program
this is a very normal progCode:void accept(int a[ ][ ],int size) { cout<<"Diagonal One:"; for (int i=0;i<size;i++) for(int j=0;j<size;j++) if (i= = j) cout<<a[i][j]<<’\t’; cout<<"\n Diagonal Two:"; for (i=0;i<size;i++) for(j=0;j<size;j++) if((i+j)= =(size-1)) cout<<a[i][j]<<’\t’; }
but i dont understand how i and j can be limited by the 'size'
i mean, i and j stand for rows and cols...so how can the loop run for total number of cells?
so i thought, size might stand for something else here...
please do help