fork download
  1. #include <stdio.h>
  2.  
  3. #define ASIZE(a) (sizeof (a) / sizeof((a)[0]))
  4.  
  5. int main(void)
  6. {
  7. short a[3];
  8. short *b;
  9. int c[2];
  10. int *d;
  11. long long e[5][4];
  12. char *f[4];
  13. char (*g)[4];
  14. (void)a; (void)b; (void)c; (void)d; (void)e; (void)f; (void)g;
  15. printf("ASIZE() accepts pointers, producing invalid results.\n");
  16. printf("%zu\n", ASIZE( a ));
  17. printf("%zu\n", ASIZE( b ));
  18. printf("%zu\n", ASIZE( c ));
  19. printf("%zu\n", ASIZE( d ));
  20. printf("%zu\n", ASIZE( e ));
  21. printf("%zu\n", ASIZE( f ));
  22. printf("%zu\n", ASIZE( g ));
  23. return 0;
  24. }
  25.  
Success #stdin #stdout 0s 2112KB
stdin
Standard input is empty
stdout
ASIZE() accepts pointers, producing invalid results.
3
2
2
1
5
4
1