17.02.2015 Views

CCS C Compiler Manual PCB / PCM / PCH

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

STATEMENTS<br />

Statements<br />

STATEMENT<br />

if (expr) stmt; [else stmt;]<br />

while (expr) stmt;<br />

do stmt while (expr);<br />

for (expr1;expr2;expr3) stmt;<br />

switch (expr) {<br />

case cexpr: stmt; //one or more case<br />

[default:stmt]<br />

... }<br />

Example<br />

return [expr]; return (5);<br />

goto label;<br />

goto loop;<br />

label: stmt;<br />

loop: i++;<br />

break;<br />

break;<br />

continue;<br />

continue;<br />

expr;<br />

i=1;<br />

; ;<br />

{[stmt]}<br />

Zero or more<br />

{a=1;<br />

b=1;}<br />

declaration; int i;<br />

Note: Items in [ ] are optional<br />

if (x==25)<br />

x=0;<br />

else<br />

x=x+1;<br />

while (get_rtcc()!=0)<br />

putc(‘n’);<br />

do {<br />

putc(c=getc());<br />

} while (c!=0);<br />

for (i=1;i

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!