13.07.2014 Views

Madagascar Programming Reference Manual

Madagascar Programming Reference Manual

Madagascar Programming Reference Manual

SHOW MORE
SHOW LESS

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

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

Chapter 4<br />

Preparing for input<br />

4.1 Convenience allocation programs (alloc.c)<br />

4.1.1 sf alloc<br />

Checks whether the requested size for memory allocation is valid and if so it returns a<br />

pointer of void type, pointing to the allocated memory block. It takes the ’number of<br />

elements’ and ’size of one element’ as input arguments. Both arguments have to be of the<br />

of type size t.<br />

Call<br />

sf_alloc (n, size);<br />

Definition<br />

void *sf_alloc (size_t n /* number of elements */,<br />

size_t size /* size of one element */)<br />

/*< output-checking allocation >*/<br />

{<br />

...<br />

}<br />

31

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

Saved successfully!

Ooh no, something went wrong!