dev • api • name • gb.newarray


void GB.NewArray ( void *parray , long size , long count )

Creates a new memory array.

  • parray must be a pointer to a variable that will receive a pointer to the array. It is not a real void * pointer, but a TYPE ** pointer casted to void *, TYPE being the type of the data that will be stored in the array.

  • size is the size of one array element. It should be sizeof(TYPE).

  • count is the number of elements in the array.

Don't mistake this function for GB.Array.New, that creates Gambas array objects.


/* Creates an array of integers with n slots */

int *array;

GB.NewArray((void *)&array, sizeof(*array), n);

See also