GeeksforGeeks » C/C++ Programming Questions
Output of C program
(3 posts)-
#include<stdio.h> int main() { int i, j; int arr[4][4] = { {1, 2, 3, 4}, {5, 6, 7, 8}, {9, 10, 11, 12}, {13, 14, 15, 16} }; for(i = 0; i < 4; i++) for(j = 0; j < 4; j++) printf("%d ", j[i[arr]] ); printf("\n\n"); for(i = 0; i < 4; i++) for(j = 0; j < 4; j++) printf("%d ", i[j[arr]] ); return 0; } -
j[i[arr]]
it is another way of writing = *(*(arr + i ) + j );
similarly for next one....just change indices in the above one. -
Output:
1234.......up to 16
Because,
a[i][j] equivalent to j[i[a]];
Reply
You must log in to post.