A 4 Meaning Of Identifiers
This page is a generated reference surface for selective reading. It exists to keep the learner apps guide-first while still preserving source access.
Learning objectives
- Explain the main ideas and vocabulary in A 4 Meaning Of Identifiers.
- Work through the source examples for A 4 Meaning Of Identifiers without depending on raw chunk order.
- Use A 4 Meaning Of Identifiers as selective reference when learner modules point back to The C Programming Language.
Prerequisites
- None curated yet.
Module targets
module-01-c-programming-fundamentals
AI companion modes
- Explain simply
- Socratic tutor
- Quiz me
- Challenge my understanding
- Diagnose my confusion
- Generate extra practice
- Revision mode
- Connect forward / backward
Source-of-truth note
This unit is anchored to The C Programming Language and the source chapter "A 4 Meaning Of Identifiers". Use external resources only to clarify, extend, or modernize details without replacing the chapter's conceptual spine.
External enrichment
No chapter-specific enrichment resources are curated yet. Add them in the unit manifest when a source clearly improves learning.
Source provenance
- Primary source:
The C Programming Language - Source chapter: A 4 Meaning Of Identifiers
- Raw source file:
062-a-4-meaning-of-identifiers.md
Merged source
A 4 Meaning Of Identifiers
A.4 Meaning of Identifiers
Identifiers, or names, refer to a variety of things: functions; tags of structures, unions, and enumerations; members of structures or unions; enumeration constants; typedef names; and objects. An object, sometimes called a variable, is a location in storage, and its interpretation depends on two main attributes: itsstorage classand itstype. The storage class determines the lifetime of the storage associated with the identified object; the type determines the meaning of the values found in the identified object. A name also has a scope, which is the region of the program in which it is known, and a linkage, which determines whether the same name in another scope refers to the same object or function. Scope and linkage are discussed in
Par.A.11.
A.4.1 Storage Class
There are two storage classes: automatic and static. Several keywords, together with the context of an object's declaration, specify its storage class. Automatic objects are local to a block (Par.9.3), and are discarded on exit from the block. Declarations within a block create automatic objects if no storage class specification is mentioned, or if theautospecifier is used.
Objects declared registerare automatic, and are (if possible) stored in fast registers of the machine.
Static objects may be local to a block or external to all blocks, but in either case retain their values across exit from and reentry to functions and blocks. Within a block, including a block that provides the code for a function, static objects are declared with the keywordstatic. The objects declared outside all blocks, at the same level as function definitions, are always static.
They may be made local to a particular translation unit by use of the statickeyword; this gives theminternal linkage. They become global to an entire program by omitting an explicit storage class, or by using the keywordextern; this gives themexternal linkage.
A.4.2 Basic Types
There are several fundamental types. The standard header <limits.h>described in Appendix
B defines the largest and smallest values of each type in the local implementation. The numbers given in Appendix B show the smallest acceptable magnitudes.
Objects declared as characters (char) are large enough to store any member of the execution character set. If a genuine character from that set is stored in a char object, its value is equivalent to the integer code for the character, and is non-negative. Other quantities may be stored intocharvariables, but the available range of values, and especially whether the value is signed, is implementation-dependent.
Unsigned characters declared unsigned char consume the same amount of space as plain characters, but always appear non-negative; explicitly signed characters declaredsigned char likewise take the same space as plain characters.
unsignedchartype does not appear in the first edition of this book, but is in common use. signed charis new.
Besides thechartypes, up to three sizes of integer, declared short int, int, andlong int, are available. Plain int objects have the natural size suggested by the host machine architecture; the other sizes are provided to meet special needs. Longer integers provide at least as much storage as shorter ones, but the implementation may make plain integers equivalent to either short integers, or long integers. The inttypes all represent signed values unless specified otherwise.
Unsigned integers, declared using the keywordunsigned, obey the laws of arithmetic modulo 2n where n is the number of bits in the representation, and thus arithmetic on unsigned quantities can never overflow. The set of non-negative values that can be stored in a signed object is a subset of the values that can be stored in the corresponding unsigned object, and the representation for the overlapping values is the same.
Any of single precision floating point (float), double precision floating point (double), and extra precision floating point (long double) may be synonymous, but the ones later in the list are at least as precise as those before.
long doubleis new. The first edition madelong floatequivalent todouble; the locution has been withdrawn.
Enumerationsare unique types that have integral values; associated with each enumeration is a set of named constants (Par.A.8.4). Enumerations behave like integers, but it is common for a compiler to issue a warning when an object of a particular enumeration is assigned something other than one of its constants, or an expression of its type.
Because objects of these types can be interpreted as numbers, they will be referred to as arithmetic types. Types char, and int of all sizes, each with or without sign, and also enumeration types, will collectively be called integral types. The types float, double, and long doublewill be calledfloatingtypes.
Thevoidtype specifies an empty set of values. It is used as the type returned by functions that generate no value.
A.4.3 Derived types
Beside the basic types, there is a conceptually infinite class of derived types constructed from the fundamental types in the following ways:
arraysof objects of a given type;
functionsreturning objects of a given type;
pointersto objects of a given type;
structurescontaining a sequence of objects of various types;
unionscapable of containing any of one of several objects of various types.
In general these methods of constructing objects can be applied recursively.
A.4.4 Type Qualifiers
An object's type may have additional qualifiers. Declaring an object constannounces that its value will not be changed; declaring it volatile announces that it has special properties relevant to optimization. Neither qualifier affects the range of values or arithmetic properties of the object. Qualifiers are discussed in Par.A.8.2.
A.5 Objects and Lvalues
AnObjectis a named region of storage; anlvalue is an expression referring to an object. An obvious example of an lvalue expression is an identifier with suitable type and storage class.
There are operators that yield lvalues, ifEis an expression of pointer type, then*Eis an lvalue expression referring to the object to which E points. The name ``lvalue'' comes from the
assignment expressionE1 = E2in which the left operandE1must be an lvalue expression. The
discussion of each operator specifies whether it expects lvalue operands and whether it yields an lvalue.