C 语言学习 --2

memset

Declaration:

void *memset(void *str, int c, size_t n);

Copies the character c (an unsigned char) to the first n characters of the string pointed to by the argument str.

The argument str is returned.

说明: 第一个参数: 是被set 的目标地址

           第二个参数是: 是要设置的字符:其长度只能是一个字节 即8位   0000 0000 -1111 1111   最小值为 1 最大值为 255

                                     如果传入的参数大于255 也就是长度超过8 位,则其只取后8位

                                      可以使用十六进制作为参数 如 0x11   即  0001 0001 也就是 int 17

           第三个参数: 是字节数,即需要设置几个字节

                                  这里需要掌握 c 语言类型中的常用数据类型的字节数  可以使用 sizeof() 求得

                                                                    

原文地址:https://www.cnblogs.com/infoo/p/9569504.html