/*
* File: main.cpp
* Author: annhe
*
* Created on 201年月日, :
*/
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char* argv[])
{
int a[]={1,2,6,4,5};
int *p=a;
cout<<"&p :"<<p<<endl;
cout<<"*p++ : "<<*p++<<endl;
cout<<"&p :"<<p<<endl;
cout<<"(*p)++ :"<<(*p)++<<endl;
cout<<"&p :"<<p<<endl;
cout<<"*(p++) :"<<*(p++)<<endl;
cout<<"&p :"<<p<<endl;
system("pause");
return 0;
}
运行结果:$ ./suffix.exe
&p :0x28fed8 //a的地址
*p++ : 1 //p[0]的值,指针右移,同 *(p++)
&p :0x28fedc //指针右移
(*p)++ :2 //p[1]的值,p[1]加1,变成3
&p :0x28fedc
*(p++) :3 //p[1]的值
&p :0x28fee0 //同*p++,指针右移
|