typedef使用

typedef:为已有的数据类型改名

typedef   已有的数据类型   新名字 ;

#include <stdio.h>
#include <stdlib.h>

typedef int INT ;//将int改名INT

/*typedef int INT ;//将int改名INT
 *INT i ; ------> int i ;
 *
 *typedef IP int * ;//将int * 改名IP
 *IP p ;-----> int *p ;
 *
 *typedef int ARR[6]; //将int[6]改名为ARR
 *ARR a ;----> int a[6] ;
 *
 *struct node_st
 *{
 *      int i ;
 *      float f ;
 *}
 * typedef struct node_st NODE ;//将一个结构体struct node_st 改名为NODE
 * NODE a ;----->struct node_st a ;
 *
 *typedef struct node_st *NODEP ;//指向结构体的指针 *p
 *NODEP p ; ----->struct node_st *p
 *
 *typedef struct
 *{
 *      int i ;
 *      float f ;
 *}NODE,*NODEP ;
 *
 *typedef int FUNC(int) ;//给函数类型int(int) 改名为FUNC;
 *FUNC f ; --->int f(int) ;
 *
 * typedef int *FUNCP(int) ;//将一个指针函数改名为FUNCP
 * FUNCP p ; --->int *p(int) ;
 *
 * typedef int * (*FUNCP)(int) ;//将一个指向指针函数的指针改名为FUNCP
 * FUNCP p ; --->int *(*p)(int) ;
 */

void int main()
{
        INT i = 10 ;
        printf("%d
",i);//打印10

        exit(0);
}
原文地址:https://www.cnblogs.com/muzihuan/p/5220650.html