1
0

praise2.c 652 B

123456789101112131415161718192021
  1. /* praise2.c */
  2. // try the %u or %lu specifiers if your implementation
  3. // does not recognize the %zd specifier
  4. #include <stdio.h>
  5. #include <string.h> /* provides strlen() prototype */
  6. #define PRAISE "You are an extraordinary being."
  7. int main(void)
  8. {
  9. char name[40];
  10. printf("What's your name? ");
  11. scanf("%s", name);
  12. printf("Hello, %s. %s\n", name, PRAISE);
  13. printf("Your name of %zd letters occupies %zd memory cells.\n",
  14. strlen(name), sizeof name);
  15. printf("The phrase of praise has %zd letters ",
  16. strlen(PRAISE));
  17. printf("and occupies %zd memory cells.\n", sizeof PRAISE);
  18. return 0;
  19. }