Error-prone point on a memset

memset(void *s,int ch,size_t n);

Action: The current position behind s n bytes is replaced with s and returns ch 

Note that the "byte" rather than the unit length, memset not consider the length of each type of unit, but the processing bytes. So when we should use the following format:

memset (a, b, n * sizeof (int)); // Int herein by example.

Guess you like

Origin www.cnblogs.com/jiading/p/11105366.html