altnames.c 474 B

12345678910111213141516
  1. /* altnames.c -- portable names for integer types */
  2. #include <stdio.h>
  3. #include <inttypes.h> // supports portable types
  4. int main(void)
  5. {
  6. int32_t me32; // me32 a 32-bit signed variable
  7. me32 = 45933945;
  8. printf("First, assume int32_t is int: ");
  9. printf("me32 = %d\n", me32);
  10. printf("Next, let's not make any assumptions.\n");
  11. printf("Instead, use a \"macro\" from inttypes.h: ");
  12. printf("me32 = %" PRId32 "\n", me32);
  13. return 0;
  14. }