ANSI C Type Qualifiers
You've seen that a variable is characterized by both its type and its storage class. ANSI C adds two more properties: constancy and volatility. These properties are declared with the keywords const and volatile, which create qualified types. The C9X committee proposes adding a third qualifier, restrict, designed to facilitate compiler optimizations; Appendix H, "The C9X Committee," discusses it briefly.
The const Type Qualifier
Chapter 4, "Character Strings and Formatted Input/Output," and Chapter 10 have already introduced const. To review, the const keyword in a declaration establishes a variable whose value cannot be modified by assignment or by incrementing or decrementing. On an ANSI-compliant compiler, the code
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.