typedef的用法

来源:互联网 发布:现场工程师 linux维护 编辑:程序博客网 时间:2024/05/16 07:57
#include <iostream.h>
//在编程中使用typedef目的一般有两个,一个是给变量一个易记且意义明确的新名字,另一个是简化一些比较复杂的类型声明
struct student
{
int age;
int no;
} s1,s2;
typedef struct student my;
typedef int myint;
 int main()
{   my q1;
    myint x=12;
q1.no=x;
q1.age=19;
cout <<"no="<<q1.no<<"  age="<<q1.age<<endl;
return  0;
}
0 0
原创粉丝点击