#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

可见:

  1. int* p, a; 这样定义aint类型,pint *类型。
  2. typedef int INT, * PINT; INT重定义是int类型,PINT重定义是int *类型。
  3. typedef int* PINT32, INT32; 和上面一样,前后位置并不影响。