fork(1) download
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {const int a = 3, b = 4;
  5. int c[a][b] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 };
  6.  
  7. int* ptr = *c;
  8.  
  9. printf("\n%u", ptr); //713549104
  10.  
  11. printf("\npointing to 2nd row=%u", ptr + 2); //713549112
  12.  
  13. printf("\n1st element in 2nd row=%u", *(ptr + b)); // 5
  14.  
  15. printf("\n3rd element in 2nd row=%u", (*(ptr + b) + 2)); //OUTPUT 7
  16.  
  17. printf("\ncontent available in 2nd row, 3rd column=%u \n", ptr[b + 2]); //7
  18.  
  19. for (int i = 0; i < a ; i++){
  20. printf("\n");
  21. for (int j = 0;j < b;j++)
  22. printf("%2u ", *(ptr + i * b + j));
  23. }
  24. }
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
1843648256
pointing to 2nd row=1843648264
1st element in 2nd row=5
3rd element in 2nd row=7
content available in 2nd row, 3rd column=7 

 1  2  3  4 
 5  6  7  8 
 9 10 11 12