使用memset() 对传入数组赋值
  • 板块学术版
  • 楼主JEB_Bem
  • 当前回复3
  • 已保存回复3
  • 发布时间2022/9/23 13:34
  • 上次更新2023/10/27 10:17:09
查看原帖
使用memset() 对传入数组赋值
561536
JEB_Bem楼主2022/9/23 13:34

代码如下,为什么会报错呢?

void clear(int *a)
{
	memset(a,0,sizeof(a));
}

错误信息

warning: argument to 'sizeof' in 'void* memset(void*, int, size_t)' call is the same expression as the destination; did you mean to dereference it? [-Wsizeof-pointer-memaccess]
2022/9/23 13:34
加载中...