c语言中typedef
什么是typedef? (What is typedef?)
typedef is a keyword in C programming language, it is used to define a name to the data type, for example, if you want to define "I" for an int variable, or "UC" for unsigned char etc.
typedef是C编程语言中的关键字,用于定义数据类型的名称,例如,如果要为int变量定义“ I” ,或者为无符号char定义“ UC”等。
Syntax:
句法:
typedef name datatype_name;
Example:
例:
#include <stdio.h>
typedef int I;
typedef char C;
typedef float F;
int main()
{
I intVar = 10;
C charVar = 'X';
F floatVar = 10.23f;
printf("intVar = %d\n",intVar);
printf("charVar = %c\n",charVar);
printf("floatVar = %f\n",floatVar);
return 0;
}
Output
输出量
intVar = 10
charVar = X
floatVar = 10.230000
翻译自: https://www.includehelp.com/c-programs/example-of-typedef-in-c-language.aspx
c语言中typedef