// ConsoleApplication1.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include <iostream>
#include <string>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
int a[5] = { 11, 22, 33, 44, 55 };
int *p = a;
//*p++ : 先返回指针所指的值,然后指针加1
cout << *p++ << endl; //打印结果: 11
cout << *p++ << endl; //打印结果: 22
cout <<a[0] << endl; //打印结果: 11
cout << "" << endl;
int b[5] = { 11, 22, 33, 44, 55 };
int *r = b;
// (*r)++ : 先返回指针所指的值,然后值加1
cout << (*r)++ << endl; //打印结果:11
cout << (*r)++ << endl; //打印结果:12
cout << b[0] << endl; //打印结果:13
cout << "" << endl;
int c[5] = { 11, 22, 33, 44, 55 };
int *h = c;
//*++h : 先将指针自加1,然后返回指针指向的值
cout << *++h << endl; //打印结果:22
cout << *++h << endl; //打印结果:33
cout << c[0] << endl; //打印结果:11
cout << "" << endl;
int d[5] = { 11, 22, 33, 44, 55 };
int *k = d;
//++*k :将指针指向的值,加1后返回
cout << ++*k << endl; //打印结果:12
cout << ++*k << endl; //打印结果:13
cout << d[0] << endl; //打印结果:13
cout << "" << endl;
system("pause");
return 0;
}
FR:海涛高软(hunk Xu) QQ技术交流群:386476712