- This wiki is out of date, use the continuation of this wiki instead
Alloc
From FenixWiki
Contents |
Definition
BYTE POINTER Alloc ( <INT size> )
Allocates a block of memory of a certain size.
Parameters
INT size | - The size of the to be allocated memory. |
Returns
BYTE POINTER : A pointer to the first element of the allocated memory block.
Example
Program example; Private byte pointer pbyte; int pointer pint; int elements = 10; int i; Begin // Allocate memory pbyte = alloc(elements); pint = alloc(elements*sizeof(int)); // Reset memory to 0's memset(pbyte,0,elements); memset(pint ,0,elements*sizeof(int)); // Write numbers to memory for(i=0; i<elements; i++) pbyte[i] = 133; *(pint+i) = 4555; end // Show numbers for(i=0; i<elements; i++) say("byte["+i+"] = " + *(pbyte+i)); say("int ["+i+"] = " + pint[i]); end Loop frame; End End