如何在strcpy的工作指针赋值? [英] How does the pointer assignment in strcpy work?

查看:220
本文介绍了如何在strcpy的工作指针赋值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在看一个例子strcpy的,他们增加指针的值,并在1号线分配给它,就像这样:

I'm looking at a strcpy example where they increase the value of a pointer, and assign it in 1 line, like this:

*ptrA++ = *ptrB++;

我知道在指针所指向的字符数组中的值被增加,并且内容被复制

I know that the value where the pointer is pointing to in the char array is increased, and the contents is copied.

确实c执行类似

*ptrA = *ptrB;
ptrA++;
ptrB++;

在后台?

推荐答案

是它,记住后缀++意味着递增之前返回值。因此,* PTRA ++递增的PTrA但增量之前返回的PTrA的反引用。

Yes it does, remember that the postfix ++ means return the value before the increment. So *ptrA++ increments ptrA but returns the dereference of of ptrA before the increment.

这篇关于如何在strcpy的工作指针赋值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆