We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
One way to dynamically allocate memory, is using malloc() (as opposed to new).
malloc()
new
malloc(size_in_bytes)
In order to use malloc(), you must import one or more of the following:
2.7/cstdlib.adept
sys/cstdlib.adept
2.7/basics.adept
The result value will be a ptr to the newly heap-allocated memory.
ptr
sizeof
Since malloc() operates in terms of bytes, it is often necessary to use sizeof in combination with malloc().
malloc(10 * sizeof int)
The difference between new and malloc(), is that new will zero-initialize the allocated memory by default.
You can optionally use new/delete instead of malloc()/free()
delete
free()
See here for more information
Table of Contents