关键字:typedef
简单地用一个新的类型名代替原有的类型名
作用:
1、不同名称代表在干不同的事情typedef int jint;;
2、不同情况下,使用不同的别名
if defined(__cplusplus) //c++
typedef _JNIEnv JNIEnv;
typedef _JavaVM JavaVM;
3.书写简洁
struct Student{
char name[20];
int age;
};
//Age int类型的别名
typedef int Age;
//Age int类型指针的别名
typedef int* Ap;
//结构体取别名
typedef struct Student m_s;
typedef struct Student* p_s;
复制代码
简写
typedef struct Student{
char name[20];
int age;
}m_s,*p_s;
复制代码typedef struct Student{
char name[20];
int age;
}MS,*PS;
//Age int类型的别名
typedef int Age;
//Age int类型指针的别名
typedef int* Ap;
结构体取别名
//typedef struct Student MS;
//typ