主题:[讨论]有个问题不能理解~
#include<iostream.h>
struct ks
{ int a;
int *b;
}s[4],*p;
void main()
{ int n=1,j;
cout<<endl;
for(j=0;j<4;j++)
{ s[j].a=n;
s[j].b=&s[j].a;
n=n+2;
cout<<s[j].a<<endl;
}
p=&s[0];
p++;
cout<<(++p)->a<<", "<<(p++)->a<<endl;
}
这些P到底指向的是哪个哦?跟我想的结果不一样艾
struct ks
{ int a;
int *b;
}s[4],*p;
void main()
{ int n=1,j;
cout<<endl;
for(j=0;j<4;j++)
{ s[j].a=n;
s[j].b=&s[j].a;
n=n+2;
cout<<s[j].a<<endl;
}
p=&s[0];
p++;
cout<<(++p)->a<<", "<<(p++)->a<<endl;
}
这些P到底指向的是哪个哦?跟我想的结果不一样艾