cstring library function? ?

memset

[Reference URL]: https://blog.csdn.net/qq_42592097/article/details/81947072)
[Reference URL]: https://blog.csdn.net/qq_39707351/article/details/83958024

(I don't understand it. It probably means that memset is only used to clear zero or assign maximum values. When assigning other values, errors are easy to occur, such as 0 1 -1)

1. Function prototype

The memset() function prototype is extern void *memset(void *buffer, int c, int count),
where buffer is a pointer or an array; c is the value paid to the buffer; count is the length of the buffer

  1. sizeof: Get the storage space occupied by the data in the memory, counting in bytes
int arr[3];				//sizeof(arr) = 16 = 4*4
char* a = &arr;			//sizeof(a) = 4 不管是指向什么类型的指针 指针存放时都占用4个字节
char str[] = {1,2,3};	//sizeof(str) = 3 = 1*3

memcpy

Guess you like

Origin blog.csdn.net/weixin_45349512/article/details/94589170