主题:关于数组名的问题
各位好:
本人最近学习vc++,遇到了一点问题。关于数组名于指针的关系问题,希望高手能指点迷津
我写了几行程序:
#include<iostream>
using namespace std;
void main()
{
int a[2][2]={0,0,0,0};
a+1;
}
编译之后给出一条警告信息warning C4552: '+' : operator has no effect; expected operator with side-effect我的理解是'+'运算符没有起作用,但是将上边的a+1改成
cout<<*(*(a+1))<<endl;就能输出0.我的问题是既然这个加号没有作用怎么在*(*(a+1))中能起作用呢?渴望得到高手指点。谢谢!
本人最近学习vc++,遇到了一点问题。关于数组名于指针的关系问题,希望高手能指点迷津
我写了几行程序:
#include<iostream>
using namespace std;
void main()
{
int a[2][2]={0,0,0,0};
a+1;
}
编译之后给出一条警告信息warning C4552: '+' : operator has no effect; expected operator with side-effect我的理解是'+'运算符没有起作用,但是将上边的a+1改成
cout<<*(*(a+1))<<endl;就能输出0.我的问题是既然这个加号没有作用怎么在*(*(a+1))中能起作用呢?渴望得到高手指点。谢谢!