Category:C: Difference between revisions

m
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. The contents of a function <b>must</b> be enclosed in curly braces for the code to count as part of that function.
 
<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===
1,489

edits