Older Newer
Mon, 30 Dec 2019 04:07:10 . . . . SyneRyder [minor formatting]


Changes by last author:

Added:
= malloc =

== Syntax ==

void* malloc(int size)

== Arguments ==

:size

::The size of the memory to be reserved, measured in bytes.

== Return ==

A pointer to the allocated memory.

== Description ==

Reserves size bytes memory.

If the memory could be allocated, a pointer to the first element in the reserved memory block is returned.

If the memory could not be allocated (e.g. due to memory shortage or a high degree of memory fragmentation), a NULL value is returned instead.

Any memory reserved by use of this function must be manually deallocated by means of the free function, failure to do so will result in memory leakage and will ultimately crash the system.

== Example ==

<code>

%ffp

OnFilterStart:

{

// Allocate a string for

// 255 characters

char* buffer_1 = malloc(255);

free(buffer_1);

}

</code>

== See Also ==

calloc, free, realloc