递增指针C中的数组 [英] incrementing an array of pointers in C

查看:85
本文介绍了递增指针C中的数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这可能是一个本质上琐碎的事情,但有些我想不起来了迄今..

this is probably an essentially trivial thing, but it somewhat escapes me, thus far..

的char * A3 [2];结果
A3 [0] =ABC;结果,
A3 [1] =DEF;结果,
焦炭** P;结果
P = A3;

这个作品:

的printf(%P - \\%s \\的\\ n,P *(++ P));

这并不:

的printf(%P - \\%s \\的\\ n,A3 *(++ A3));

我在编译得到的我的错误是:

the error i'm getting at compilation is:

需要作为增量操作数左值

lvalue required as increment operand

我是什么做错了,为什么,什么是解决方案'A3'?

what am i doing wrong, why and what is the solution for 'a3'?

推荐答案

A3是一个常量指针,你不能增加它。 P,然而是一个通用的指针至a3的开始可被递增。

a3 is a constant pointer, you can not increment it. "p" however is a generic pointer to the start of a3 which can be incremented.

这篇关于递增指针C中的数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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