Category:C: Difference between revisions
m
→Curly Braces
Puppydrum64 (talk | contribs) m (→Curly Braces) |
Puppydrum64 (talk | contribs) m (→Curly Braces) |
||
Line 29:
===Curly Braces===
C uses curly braces as a separator for sections of code. All curly braces must be "balanced," i.e. every left curly brace must have a right curly brace after it. Most code writing programs will do this for you automatically.
<lang C>int main()
Line 38:
}</lang>
The contents of a function, if statement, etc. <b>must</b> be enclosed in curly braces for the code to count as part of that section.
<lang C>int main()
{
if (a == 3)
{
x = y;
}
y = z; //this is not part of the if statement and does not depend on whether a equals 3.
}
===Semicolons===
|