Datasheet

/* Definition of variable i: */
int i;
/* Following line is an error, i is already defined! */
int i;
Declarations and Declarators
The declaration contains specifier(s) followed by one or more identifiers (declara-
tors). The declaration begins with optional storage class specifiers, type specifiers,
and other modifiers. The identifiers are separated by commas and the list is termi-
nated by a semicolon.
Declarations of variable identifiers have the following pattern:
storage-class [type-qualifier] type var1 [=init1], var2 [=init2], ... ;
where var1, var2,... are any sequence of distinct identifiers with optional initial-
izers. Each of the variables is declared to be of type; if omitted, type defaults to int.
The specifier storage-class can take the values extern, static, register, or the
default auto. Optional type-qualifier can take values const or volatile. For
more details, refer to Storage Classes and Type Qualifiers.
For example:
/* Create 3 integer variables called x, y, and z
and initialize x and y to the values 1 and 2, respectively: */
int x = 1, y = 2, z; // z remains uninitialized
/* Create a floating-point variable q with static modifier,
and initialize it to 0.25: */
static float q = .25;
These are all defining declarations; storage is allocated and any optional initializers
are applied.
179
MIKROELEKTRONIKA - SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Language Reference
mikroC PRO for AVR
CHAPTER 5