C经典 宏与typedef的区别

#include <stdio.h>
#define HONG int*
typedef int T;
typedef int* PT;
int main(int argc, const char * argv[])
{

    // 1.宏
    HONG a,b; //a是指针,b是普通变量
    int num = 10;
    a = &num;
    b = 10;

    // 2.typedef;
    T x,y;
    x = 100;
    y = 100;

    // 3.typedef指针
    PT m,n; //m,n都是指针
    m = &num;
    n = &num;
    printf("%d,%d\n", *m,*n);

    printf("\n");
    return 0;
}

你可能感兴趣的:(C语言,指针,宏,typedef)