gpt4 book ai didi

c - 在 C 中向字符数组加一有什么作用?

转载 作者:太空宇宙 更新时间:2023-11-04 00:17:36 25 4
gpt4 key购买 nike

出于学习目的,我正在浏览一些代码。我正在研究这部分代码。

// e.g. const unsigned char data={0x1,0x7C ... }
unsigned char buf[40];
memset(buf,0,40);
buf[0] = 0x52;
memcpy(buf+1, data, length); // What does buf+1 do in this situation?

在调用 memcpy 的最后一行,buf+1 做了什么? buf 是一个字符数组,那么 +1 对它有什么作用呢?

最佳答案

buf+1 等价于&(buf[1])

关于c - 在 C 中向字符数组加一有什么作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1391583/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com