Chapter 2

  1. They are called functions.

  2. A syntax error is a violation of the rules governing how sentences or programs are put together. Here's an example in English: "Me speak English good." Here's an example in C:

    printf"Where are the parentheses?";.
    
  3. A semantic error is one of meaning. Here's an example in English: "This sentence is excellent Italian." Here's a C example:

    thrice_n = 3 + n;
    
  4. Line 1: Begin the line with a #; spell the file stdio.h; place the filename within angle brackets.

    Line 2: Use (), not {}; end comment with */, not /*.

    Line 3: Use {, not (.

    Line 4: Complete the statement with a semicolon.

    Line 5: Mr. I.B.M. got this one (the blank line) right!

    Line 6: Use =, not := for assignment. (Apparently, Mr. I.B.M. knows a little Pascal.) ...

Get C Primer Plus®, Third 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.