GeeksforGeeks » C/C++ Programming Questions

Output of C program

(3 posts)
  • Started 3 months ago by geek4u
  • Latest reply from PINTUGUPTAJUIT

Tags:

  1. geek4u
    Member
    Posted 3 months ago #

    #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;
    }
    
  2. atul007
    Member
    Posted 3 months ago #

    j[i[arr]]

    it is another way of writing = *(*(arr + i ) + j );
    similarly for next one....just change indices in the above one.

  3. PINTUGUPTAJUIT
    Member
    Posted 3 months ago #

    Output:
    1234.......up to 16
    Because,
    a[i][j] equivalent to j[i[a]];


Reply

You must log in to post.

RSS feed for this topic