-1
是* ptr ++与*(ptr + 1)相同吗?我有一个名为arr的数组。比> int * ptr = arr;阵列conatins简单的算术整数,例如:ARR [0] = 0,ARR [1] = 1 ..C指针:* ptr ++或*(ptr +1)
printf(" Initial value of *ptr %d \n",*ptr);
*ptr++;
printf(" value of *ptr after *ptr++ %d \n",*ptr);
*(ptr++);
printf(" value of *ptr after *(ptr++) %d \n",*ptr);
*(ptr+1);
printf(" value of *ptr after *(ptr+1) %d \n",*ptr);
*ptr+1;
printf(" value of *ptr after *ptr+1 %d \n",*ptr);
的输出是:
0
1
2
2
2
不应该是最后值3和4?不是* ptr ++ = * ptr + 1或= *(ptr + 1)?
请帮忙。学习C的概念。
独立'*(PTR + 1);'是无操作。它什么也没做。但是'* ptr ++;'改变了ptr的值。 – keltar 2014-11-08 15:11:34