array_resize()

Resizes array.

Syntax

array_resize(hnd, newsize);

Parameters

hnd Array handle of to be resized array.
newsize New array size. When resizing, data can be added or removed.
Negative number will pre-append/remove the data at the start position of array.
Positive number will append/remove the data at the end position of array.
Return Value Return value is new array size. Returned value is integer number.

Example

hnd = array_new();
array_setdata(hnd, 0, 0x01, 0x02, 0x03, 0x04, 0x05);
result = array_printdata(hnd);
array_resize(hnd, 8);
result = array_printdata(hnd);
array_delete(hnd);
5; 0x01, 0x02, 0x03, 0x04, 0x05
8; 0x01, 0x02, 0x03, 0x04, 0x05, 0x00, 0x00, 0x00

hnd = array_new();
array_setdata(hnd, 0, 0x01, 0x02, 0x03, 0x04, 0x05);
result = array_printdata(hnd);
array_resize(hnd, -8);
result = array_printdata(hnd);
array_delete(hnd);
5; 0x01, 0x02, 0x03, 0x04, 0x05
8; 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05

See also

array_new, array_delete, array_size, array_setdata, array_printdata