typedef应用示例

1、普通变量的数据类型,指针变量的数据类型

typedef  int ElemType;    //只需要更改此处的int即可。

typedef ElemType *pointer;

ElemType value;

pointer p;

2、函数返回值类型

#define  success 0

#define fail -1

#define other -2

typedef  int status ;

status func()

{

   return success;

   //return fail;

   //return other;

}

发布了25 篇原创文章 · 获赞 18 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/modi000/article/details/104200940