#include<stdio.h>
int main()
{
int *p;
int arr[]={10,20};
p=arr;
++*p;
printf("arr[0]=%d, arr[1]= %d, p=%d\n",arr[0],arr[1],*p);
}
Conclusion = arr[0]=11, arr[1]= 20, p=11which is completely beautiful. But here
#include<stdio.h>
int main()
{
int *p;
int arr[]={10,20};
p=arr;
++*p++;
printf("arr[0]=%d, arr[1]= %d, p=%d\n",arr[0],arr[1],*p);
}
Since the priority of postfix is ++higher, the value a[1]or *pshould be 21, but there is:
arr[0]=11, arr[1]= 20, p=20
For some reason, does it not increase? Why?
source
share