(编译后的报错/警告记录)implicit declaration of function ‘memset’

一步到位,不看流程

memset第一个参数是void * 类型,我用的是char类型
1.使用强制转换
2.需要包含include <string.h>

警告

使用memset后警告 implicit declaration of function ‘memset’ [-Wimplicit-function-declaration
在这里插入图片描述

原因

memset()函数原型是extern void *memset(void *buffer, int c, int count)

第一个参数是void * 类型 我用的是char类型

过程

使用强制转换后依旧警告在这里插入图片描述

解决

需要include <string.h>

猜你喜欢

转载自blog.csdn.net/weixin_43387612/article/details/89259944