putArray

Syntax

int putArray (int nr, int x, int y, int z, int val)

Arguments

nr
Number of the array. Values from 0 to 99 are acccepted.
x, y, z
x, y, and z coordinates of a cell in the array. If you allocated a one-dimensional array, set y and z to zero. If you allocated a two-dimensional array, set z to zero.
val
Value that will be stored at the specified coordinates in the array.

Return

Returns 0 for failure (invalid index nr, or invalid byte-size of Array), and 1 for success.

Description

Lets you store a value in an array. When storing a value into an Array with byte-size 1, the value will be clamped to the range [0,255]. For an Array of byte-size 2, the value is clamped to [0,65535]. If the byte-size is not 1, 2, or 4, a value of 0 is returned to indicate failure.

Example

See allocArray

Also see

allocArray, freeArray, getArray, fgetArray, fputArray, fillArray, ffillArray, getArrayDim, copyArray

Comments

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