t2:memset

memset


memset - Fill memory with a constant byte

Description


void memset(void *dst, uint8 val, int16 size);

The memset() function fills the first size bytes of the memory area pointed to by dst with the constant byte val.

Parameters


  • dst: Pointer to the block of memory to fill.
  • val: Value to be set.
  • size: Number of bytes to be set to the value.

Return Value


No value is returned.

Examples


Example #1 memset() example

uint8 arr[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
 
init {
    memset(&arr, 0, sizeof(arr)); // All arr[] elements are now 0
}

See Also

t2/memset.txt · Last modified: 2016/11/12 10:00 by J2Kbr