Review Questions

You'll find answers to the review questions in Appendix A, “Answers to Review Questions.”

1:Run Listing 4.1 again, but this time give your first and last name when it asks you for your first name. What happens? Why?
2:Assuming that each of the following examples is part of a complete program, what will each one print?
  1. printf("He sold the painting for $%2.2f.\n", 2.345e2);

  2. printf("%c%c%c\n", 'H', 105, '\41');

  3. #define Q "His Hamlet was funny without being vulgar."
    printf("%s\nhas %d characters.\n", Q, strlen(Q));
    
  4. printf("Is %2.2e the same as %2.2f?\n", 1201.0, 1201.0);

3:In Question 2c, what changes could you make so that string Q is printed out enclosed in double quotation marks?
4:It's find the error time!
 define B booboo define ...

Get C Primer Plus, Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.