主题:[讨论]为何
#include<stdio.h>
void pointer1(int x,int y)
{
int t=1;
x=x+t;y=y+t;
return;
}
void pointer2(int *x,int *y)
{
int t=1;
*x=*x+t;
*y=*y+t;
return;
}
void pointer3(char *p)
{
p+=2;
*p=*p+1;
}
void main()
{
char b[4]={'a','v','w','z'},*pt=b;
int x=2,y=3;
pointer1(x,y);
printf("x=%d y=%d\n",x,y);
pointer2(&x,&y);
printf("x=%d y=%d\n",x,y);
pointer3(pt);
printf("*(pt+2)=%c \n",*(pt+2));
}
point1(x,y)为何输出的是2,3而不是2,4
pointer3(pt)为何输出的是x ??