sizeof.c 319 B

1234567891011121314
  1. // sizeof.c -- uses sizeof operator
  2. // uses C99 %z modifier -- try %u or %lu if you lack %zd
  3. #include <stdio.h>
  4. int main(void)
  5. {
  6. int n = 0;
  7. size_t intsize;
  8. intsize = sizeof (int);
  9. printf("n = %d, n has %zd bytes; all ints have %zd bytes.\n",
  10. n, sizeof n, intsize );
  11. return 0;
  12. }