[Main]
Title=Equal sign ('=')
Index==

[Top]
The <CODE>'='</CODE> (equal sign) used as a punctuator separates variable declarations from initialization
lists. For example,
<PRE>int array[5] = { 1, 2, 3, 4, 5 };
char *name = "Fred";
int x = 12;
</PRE>
In a C function, no code can precede any variable declarations. Note that the GNU C,
in opposite to other C dialects, allow <A HREF="$$INFOLINK(gnuexts/SEC80)">non-constant
initializers</A> (like in C++).
<BR><BR>
The equal sign is also used in <A HREF="$$INFOLINK(keywords/enum)">enumerations</A>:
<PRE>enum colors {Blue = 1, Red = 2, Green = 4, Light = 8};
</PRE>
It is also used as the <A HREF="$$LINK(assign)">assignment operator</A> in expressions:
<PRE>a = b + c;
</PRE>
or even:
<PRE>a = b + 2 * (c = d - 1);
</PRE>
<B>Note:</B> The GNU C extends the usage of equal sign (as a punctuator) to allow
<A HREF="$$INFOLINK(gnuexts/SEC82)">labeling elements in initializers</A>.
