expand

Syntax

int expand(int pointer, int size)

Arguments

pointer
Pointer to the block of memory to expand
size
The new size of the memory block, in bytes

Return

A pointer to the resized block of memory, or NULL if there was an error resizing the memory block.

Description

Resizes a block of memory to a new, larger size. expand cannot be used to make a memory block smaller (use realloc for this instead). expand can only be used to expand memory "in place" - that is, without moving the memory block to another position in memory. For this reason, expand is not always able to give you the maximum expansion that you ask for, so be sure to check the size of the new block by using msize.

Example

Also see

malloc, realloc, msize, free

Comments

Everyone can add his comments about his experiences with this function here. Tips for using it are welcome, too.