MC logo

Legal Identifiers (Answer)

  Practice Questions

Is each of these a legal C identifier?

  1. bump

    Yes.

  2. A_b_2

    Yes. The underscore is treated as a letter.

  3. _X_

    Yes. The underscore really is treated as a letter. Even ___ is an identifier.

  4. 23skidoo

    No. Starts with 23.

  5. _99

    Yes. The underscore is still treated as a letter.

  6. WHILE

    Yes. Since C is case-sensitive, WHILE is different from while. WHILE is not a keyword, so it is an identifier. It would not be good style to use it as an identifier, however, since it would be rather confusing.


Question Assignment and Side Effects I>>