fork download
  1. #include <stdio.h>
  2. #include <assert.h>
  3.  
  4. int main(void)
  5. {
  6.  
  7. int (*a)[2];
  8. int b[5];
  9.  
  10. printf("sizeof(int) : %zu\n", sizeof(int));
  11. printf("sizeof(int*) : %zu\n", sizeof(int*));
  12.  
  13. assert(sizeof(b) == sizeof(int [5]));
  14. assert(sizeof((int*)b) == sizeof(int *));
  15. assert(sizeof(&b[0]) == sizeof(int *));
  16.  
  17. assert(sizeof(a) == sizeof(int(*)[2]));
  18. assert(sizeof(a[0]) == sizeof(int[2]));
  19. assert(sizeof(a[1]) == sizeof(int[2]));
  20.  
  21. return 0;
  22. }
  23.  
Success #stdin #stdout 0s 2160KB
stdin
Standard input is empty
stdout
sizeof(int) : 4
sizeof(int*) : 4