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.

Built-in Functions<br />

calloc( )<br />

Syntax:<br />

Parameters:<br />

Returns:<br />

Function:<br />

Availability:<br />

Requires:<br />

Examples:<br />

Example Files:<br />

Also See:<br />

ptr=calloc(nmem, size)<br />

nmem is an integer representing the number of member objects<br />

size is the number of bytes to be allocated for each one of them.<br />

A pointer to the allocated memory, if any. Returns null otherwise.<br />

The calloc function allocates space for an array of nmem objects whose size is<br />

specified by size. The space is initialized to all bits zero.<br />

All devices<br />

#INCLUDE <br />

int * iptr;<br />

iptr=calloc(5,10);<br />

// iptr will point to a block of memory of<br />

// 50 bytes all initialized to 0.<br />

None<br />

realloc(), free(), malloc()<br />

ceil( )<br />

Syntax:<br />

Parameters:<br />

Returns:<br />

Function:<br />

Availability:<br />

Requires:<br />

Examples:<br />

result = ceil (value)<br />

value is a float<br />

A float<br />

Computes the smallest integer value greater than the argument. CEIL(12.67) is<br />

13.00.<br />

All devices<br />

#INCLUDE<br />

// Calculate cost based on weight rounded<br />

// up to the next pound<br />

cost = ceil( weight ) * DollarsPerPound;<br />

Example Files:<br />

None<br />

165

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

Saved successfully!

Ooh no, something went wrong!