#include struct ord { int x,y;} dt[2]={1,2,3,4}; main() {str
来源:学生作业帮 编辑:百度作业网作业帮 分类:综合作业 时间:2024/06/13 13:16:29
#include struct ord { int x,y;} dt[2]={1,2,3,4}; main() {struct ord *p=dt; printf("%d,",++
#include
struct ord
{
int x,y;} dt[2]={1,2,3,4};
main()
{struct ord *p=dt;
printf("%d,",++p->x);
printf("%d,",++p->y);
}
++p->x
++p->y
#include
struct ord
{
int x,y;} dt[2]={1,2,3,4};
main()
{struct ord *p=dt;
printf("%d,",++p->x);
printf("%d,",++p->y);
}
++p->x
++p->y
取值运算的优先级高于++
++p->x
++p->y
的含义等同于
++(p->x)
++(p->y)
前缀++,--与后缀++,--的区别在于
++i时,i=i+1,既i自增之后使用i
而i++表示,i=i,i=i+1既先使用i,然后i自增1
再问: 那结果为什么是2.3啊,p>x是怎么对应到函数中的啊 ?帮忙解释下这些语句吧 ,谢了
再答: dt[2]={1,2,3,4}表示dt[0]={1,2},dt[1]={3,4} p=dt表示p是dt数组的首地址,既此时p指向的数组是dt[0],p+1指向dt[1]; 因此p->x=1,p->y=2,所以输出结果为2,3。
++p->x
++p->y
的含义等同于
++(p->x)
++(p->y)
前缀++,--与后缀++,--的区别在于
++i时,i=i+1,既i自增之后使用i
而i++表示,i=i,i=i+1既先使用i,然后i自增1
再问: 那结果为什么是2.3啊,p>x是怎么对应到函数中的啊 ?帮忙解释下这些语句吧 ,谢了
再答: dt[2]={1,2,3,4}表示dt[0]={1,2},dt[1]={3,4} p=dt表示p是dt数组的首地址,既此时p指向的数组是dt[0],p+1指向dt[1]; 因此p->x=1,p->y=2,所以输出结果为2,3。
#include struct ord { int x,y;} dt[2]={1,2,3,4}; main() {str
struct ord {int x,y;}dt[2]={1,2,3,
Struct Struct st {int x;int *y;}*pt; Int a[]={1,2},b[]={3,4}
struct st{int x;int*y;}*p;inta[]={1,2},b[]={3,4};struct st c
#include void f(int*x,int y) {*x=y+1;y=*x+2;} main() {int a=
#include void main() { int x=2,y; switch(x) { case 1:y=x ; b
以下程序的输出结果是 struct HAR {int x,y; struct HAR *P;} h[2]; main()
# include void p(int *x,int y){ ++*x; y=y+2; } void main() {
#include void main(){int k1=1;int k2=2;int k3=3;int x=15;if(
#include Int main(void ) { int a = 5,b = 4,x,y; x = 2 * a++
#include int main() { int x=2,y=3; float i; i=float(x); prin
#include main() { int x=1,y=3; x=9-(--y)-(--y); printf("%d",