memset(num,0,sizeof num);是什么意思?

zhangxin52 2011-04-03 06:44:00
memset(num,0,sizeof num);是什么意思?
...全文
1160 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
BuleRiver 2011-04-04
  • 打赏
  • 举报
回复
把num内存单元清0
dcw0402 2011-04-04
  • 打赏
  • 举报
回复
#2楼 +1
wizard_tiger 2011-04-04
  • 打赏
  • 举报
回复
设置num数组中所有数据为0。
delphiwcdj 2011-04-03
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 luciferisnotsatan 的回复:]

就是将从num处开始的sizeof num长的内存都设为0。
可以查MSDN
[/Quote]
都已经解释很详细了,多用就熟悉了
luciferisnotsatan 2011-04-03
  • 打赏
  • 举报
回复
就是将从num处开始的sizeof num长的内存都设为0。
可以查MSDN
ifengshow 2011-04-03
  • 打赏
  • 举报
回复
你浪费分了,发了两帖子
pathuang68 2011-04-03
  • 打赏
  • 举报
回复
果然发重复了。
elegant87 2011-04-03
  • 打赏
  • 举报
回复
内存操作函数
memset(num,0,sizeof num);
将以num为起始地址的数组全部初始化为0

void * memset ( void * ptr, int value, size_t num );

Fill block of memory
Sets the first num bytes of the block of memory pointed by ptr to the specified value (interpreted as an unsigned char).

Parameters

ptr
Pointer to the block of memory to fill.
value
Value to be set. The value is passed as an int, but the function fills the block of memory using the unsigned char conversion of this value.
num
Number of bytes to be set to the value.
flower_fancy 2011-04-03
  • 打赏
  • 举报
回复
将num所指的内存单元清零。。。

65,210

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧