Identifiers
Identifiers are names of variables, functions, macros, types, etc. Identifiers are subject to the following formative rules:
An identifier consists of a sequence of letters (
AtoZ,atoz), digits (0to9), and underscores (_).The first character of an identifier must not be a digit.
Identifiers are case-sensitive.
There is no restriction on the length of an identifier. However, only the first 31 characters are generally significant.
Keywords are reserved and must not be used as identifiers. Following is a list of keywords:
auto |
enum |
restrict(*) |
unsigned |
break |
extern |
return |
void |
case |
float |
short |
volatile |
char |
for |
signed |
while |
const |
goto |
sizeof |
_Bool(*) |
continue |
if |
static |
_Complex(*) |
default |
inline(*) |
struct |
_Imaginary(*) |
do |
int |
switch | |
double |
long |
typedef | |
else |
register |
union |
External names —that is, identifiers of externally linked functions and variables—may be subject to other restrictions, depending on the linker: in portable C programs, external names should be chosen so that only the first eight characters are significant, even if the linker is not case-sensitive.
Some examples of identifiers are:
Valid: a, DM, dm, FLOAT, _var1, topOfWindow
|
Invalid: do, 586_cpu, zähler, nl-flag, US_$
|
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