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.

4.1. CONVENIENCE ALLOCATION PROGRAMS (ALLOC.C) 41<br />

Output<br />

ptr<br />

a void pointer pointing to the allocated block of memory.<br />

4.1.14 sf boolalloc2<br />

Allocates a 2D array in the memory for the bool type. It works just like sf boolalloc<br />

but does it for two dimensions. This is done by making a pointer point to another pointer,<br />

which in turn points to a particular column (or row) of an allocated 2D block of memory<br />

of size n1*n2. n1 is the fastest dimension.<br />

Call<br />

ptr = sf_boolalloc2 (n1, n2);<br />

Definition<br />

bool **sf_boolalloc2 (size_t n1 /* fast dimension */,<br />

size_t n2 /* slow dimension */)<br />

/*< bool 2-D allocation, out[0] points to a contiguous array >*/<br />

{<br />

...<br />

}<br />

Input parameters<br />

n1<br />

n2<br />

number of elements in the fastest dimension (size t).<br />

number of elements in the slower dimension (size t).<br />

Output<br />

ptr<br />

a void pointer pointing to the allocated block of memory.<br />

4.1.15 sf boolalloc3<br />

Allocates a 3D array in the memory for the bool type. It works just like sf boolalloc2<br />

but does it for three dimensions. This is done by extending the same argument as for

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

Saved successfully!

Ooh no, something went wrong!