#include <iostream>
using namespace std;
typedef int INT, * PINT;
typedef int* PINT32, INT32;
int main()
{
int* p, a;
a = 10;
p = &a;
cout << *p << endl;
PINT p_t = p;
*p_t = 11;
cout << *p_t << endl;
PINT32 p_t32 = p_t;
*p_t32 = 12;
cout << *p_t32 << endl;
return 0;
}
输出:
10
11
12
可见:
-
int* p, a;
这样定义a
是int
类型,p
是int *
类型。 -
typedef int INT, * PINT;
INT
重定义是int
类型,PINT
重定义是int *
类型。 -
typedef int* PINT32, INT32;
和上面一样,前后位置并不影响。