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.

FUNCTION DEFINITION<br />

Function Definition<br />

The format of a function definition is as follows:<br />

[qualifier] id ( [type-specifier id] ) { [stmt] }<br />

Optional See Below<br />

Zero or more comma<br />

separated.<br />

See Data Types<br />

Zero or more Semi-colon<br />

separated. See<br />

Statements.<br />

The qualifiers for a function are as follows:<br />

VOID<br />

type-specifier<br />

#separate<br />

#inline<br />

#int_..<br />

When one of the above are used and the function has a prototype (forward declaration of the<br />

function before it is defined) you must include the qualifier on both the prototype and function<br />

definition.<br />

A (non-standard) feature has been added to the compiler to help get around the problems<br />

created by the fact that pointers cannot be created to constant strings. A function that has one<br />

CHAR parameter will accept a constant string where it is called. The compiler will generate a<br />

loop that will call the function once for each character in the string.<br />

Example:<br />

void lcd_putc(char c ) {<br />

...<br />

}<br />

lcd_putc ("Hi There.");<br />

SEE ALSO:<br />

Overloaded Functions<br />

Reference Parameters<br />

Default Parameters<br />

Variable Parameters<br />

37

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

Saved successfully!

Ooh no, something went wrong!