beautypg.com

Calloc, Ceil, ceilf, Calloc ceil, ceilf – Zilog ZUSBOPTS User Manual

Page 441: Synopsis, Returns, Example

background image

UM017105-0511

Standard Functions

Zilog Developer Studio II – ZNEO™

User Manual

413

calloc

Allocates space for an array of nmemb objects, each of whose size is

size

. The space is

initialized to all bits zero.

Synopsis

#include

void *calloc(size_t nmemb, size_t size);

Returns

A pointer to the start (lowest byte address) of the allocated space. If the space cannot be
allocated, or if nmemb or

size

is zero, the

calloc

function returns a null pointer.

Example

char *buf;

buf = (char*)calloc(40, sizeof(char));

if (buf != NULL)

/*success*/

else

/*fail*/

ceil, ceilf

Computes the smallest integer not less than x.

Synopsis

#include

double ceil(double x);

float ceilf(float x);

Returns

The smallest integer not less than x, expressed as a

double

for

ceil

and expressed as a

float

for

ceilf

.

Example

double y=1.45;

double x;

x=ceil(y);

This manual is related to the following products: