c/language/identifier

An identifier is an arbitrarily long sequence of digits, underscores, lowercase and uppercase Latin letters. A valid identifier must begin with a non-digit character (Latin letter, underscore). Identifiers are case-sensitive (lowercase and uppercase letters are distinct).

Identifiers can denote the following types of entities:
 * s
 * tags (,, or s)
 * structure or union members
 * enumeration constants
 * names
 * names
 * macro names
 * macro parameter names
 * macro parameter names

Every identifier other than macro names or macro parameter names has, belongs to a , and may have. The same identifier can denote different entities at different points in the program, or may denote different entities at the same point if the entities are in different name spaces.

Reserved identifiers
The following identifiers are reserved and may not be declared in a program (doing so invokes undefined behavior):  The identifiers that are keywords cannot be used for other purposes. In particular #define or #undef of an identifier that is identical to a keyword is not allowed. All external identifiers that begin with an underscore. All identifiers that begin with an underscore followed by a capital letter or by another underscore (these reserved identifiers allow the library to use numerous behind-the-scenes non-external macros and functions). All external identifiers defined by the standard library (in hosted environment). This means that no user-supplied external names are allowed to match any library names, not even if declaring a function that is identical to a library function. Identifiers declared as reserved for the implementation or future use by the standard library (see below).  Identifiers declared as potentially reserved and provided by the implementation (see below).  

All other identifiers are available. Identifiers that are not reserved can be used with no fear of unexpected collisions when moving programs from one compiler and library to another.

Note: in C++, identifiers with a double underscore anywhere are reserved everywhere; in C, only the ones that begin with a double underscore are reserved.

Reserved and potentially reserved identifiers in the library
The standard library reserves every identifiers it provides. Reserved identifiers that have (e.g. name of every standard function) are reserved regardless which header is included. Other reserved identifiers are reserved when any of its associated headers is included.

Following identifiers are reserved for the implementation or future use by the standard library.

 function names <ul> <li class="t-rev-inl t-rev-inl-noborder t-since-c99">, , , , , , , , and their -f and -l suffixed variants, in  </li> beginning with or  followed by a lowercase letter, in </li> beginning with  followed by a lowercase letter, in  </li> <li class="t-rev-inl t-rev-inl-noborder t-since-c23"> beginning with, in </li> <li class="t-rev-inl t-rev-inl-noborder t-since-c95"> beginning with followed by a lowercase letter, in  </li> <li class="t-rev-inl t-rev-inl-noborder t-since-c11"> beginning with followed by a lowercase letter, in  </li> <li class="t-rev-inl t-rev-inl-noborder t-since-c11"> beginning with, , or  followed by a lowercase letter, in  </li> </ul> </li> typedef names <ul> <li class="t-rev-inl t-rev-inl-noborder t-since-c99"> beginning with or  and ending with, in  </li> <li class="t-rev-inl t-rev-inl-noborder t-since-c11"> beginning with or  followed by a lowercase letter, in  </li> <li class="t-rev-inl t-rev-inl-noborder t-since-c11"> beginning with, , or  followed by a lowercase letter, in  </li> </ul> </li> macro names <ul> beginning with followed by a digit or an uppercase letter, in </li> <li class="t-rev-inl t-rev-inl-noborder t-since-c99"> beginning with followed by an uppercase letter, in  </li> <li class="t-rev-inl t-rev-inl-noborder t-since-c23"> beginning with, , , , , , or followed by an uppercase letter, in ; these identifiers are potentially reserved </li> <li class="t-rev-inl t-rev-inl-noborder t-since-c99"> beginning with or  and ending with, , or , in  </li> <li class="t-rev-inl t-rev-inl-noborder t-since-c99"> beginning with or  followed by lowercase letter or the letter, in  </li> beginning with followed by an uppercase letter, in </li> <li class="t-rev-inl t-rev-inl-noborder t-since-c23"> beginning with followed by an uppercase letter, in  </li> <li class="t-rev-inl t-rev-inl-noborder t-since-c23"> beginning with followed by an uppercase letter, in ; these identifiers are potentially reserved </li> beginning with or  followed by an uppercase letter, in </li> <li class="t-rev-inl t-rev-inl-noborder t-since-c11"> beginning with followed by an uppercase letter, in  </li> <li class="t-rev-inl t-rev-inl-noborder t-since-c11"> beginning with followed by an uppercase letter, in  </li> </ul> </li> enumeration constants <ul> <li class="t-rev-inl t-rev-inl-noborder t-since-c11"> beginning with followed by a lowercase letter, in  </li> <li class="t-rev-inl t-rev-inl-noborder t-since-c11"> beginning with, , or  followed by a lowercase letter, in  </li> </ul> </li> </ul>

Translation limits
Even though there is no specific limit on the length of identifiers, early compilers had limits on the number of significant initial characters in identifiers and the linkers imposed stricter limits on the names with. C requires that at least the following limits are supported by any standard-compliant implementation: