memset 函数的用法及常见错误
转载自https://blog.csdn.net/pugu12/article/details/46861923
转载自https://blog.csdn.net/qq_42991793/article/details/81751284
转载自https://baike.baidu.com/item/memset/4747579?fr=aladdin
bzero 函数和 memset 函数在功能上有相似之处,因此也做一个简单介绍。
1. bzero()函数
原型:extern void bzero(void *s, int n);
功能:置字节字符串 s 的前 n 个字节为零且包括 ‘\0’ 。
说明:bzero 无返回值,并且使用 strings.h 头文件,strings.h 曾经是 posix 标准的一部分,但是在 POSIX.1-2001 标准里面,这些函数被标记为了遗留函数而不推荐使用。在 POSIX.1-2008 标准里已经没有这些函数了。
操作实例:
#include <stdio.h>
#include <string.h>
int main(void)
{
struct
{
int a;