Core Function Alloc
From Sputnik Wiki
(Difference between revisions)
UberFoX (Talk | contribs)
(Created page with "<pre> Alloc( <size>, <flag> ) </pre> === Description === Allocate memory and return the pointer to it. === Parameters=== ==== size ==== Size in bytes to allocate. ==== flag...")
Newer edit →
(Created page with "<pre> Alloc( <size>, <flag> ) </pre> === Description === Allocate memory and return the pointer to it. === Parameters=== ==== size ==== Size in bytes to allocate. ==== flag...")
Newer edit →
Revision as of 01:14, 9 December 2011
Alloc( <size>, <flag> )
Contents |
Description
Allocate memory and return the pointer to it.
Parameters
size
Size in bytes to allocate.
flag
Optional; If higher than 0 the allocated memory will be zeroed.
Return Value
Success: Returns a valid pointer.
Failure: Returns 0.
Remarks
None.
Example
$PTR = Alloc(300); PTRWrite($PTR, "f", 0, 133.77); PTRWrite($PTR, "l", 4, 777); PTRWrite($PTR, "i", 12, 1221); Println( PTRRead($PTR, "f", 0) ); Println( PTRRead($PTR, "l", 4) ); Println( PTRRead($PTR, "i", 12) ); Free($PTR);