Chapter 11. Declarations
A declaration determines the significance and properties of one or more identifiers . The identifiers you declare can be the names of objects, functions, types, or other things, such as enumeration constants. Identifiers of objects and functions can have various types and scopes. The compiler needs to know all of these characteristics of an identifier before you can use it in an expression. For this reason, each translation unit must contain a declaration of each identifier used in it.
Labels used as the destination of goto statements may be placed before any
statement. These identifiers are declared implicitly where they occur.
All other identifiers require explicit declaration before their first
use, either outside of all functions or at the beginning of a block. In
C99, declarations may also appear after statements within a block.
After you have declared an identifier, you can use it in expressions until the end of its scope. The identifiers of objects and functions can have file or block scope (see "Identifier Scope" in Chapter 1).
General Syntax
There are several different kinds of declarations:
Declarations that only declare a structure, union, or enumeration tag, or the members of an enumeration (that is, the enumeration constants)
Declarations that declare one or more object or function identifiers
typedefdeclarations, which declare new names for existing types
Declarations of enumerated, structure, and union types are described in Chapter 2 and Chapter ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access