手机
当前位置:查字典教程网 >编程开发 >C语言 >typedef_struct与struct之间的区别
typedef_struct与struct之间的区别
摘要:复制代码代码如下:#includeusingnamespacestd;voidmain(){intx;//MSG1作为结构A的别名typed...

复制代码 代码如下:

#include <iostream>

using namespace std;

void main()

{

int x;

//MSG1作为结构A的别名

typedef struct A{

int age;

char s;

}MSG1,*p1;

MSG1 msg1 ;

msg1.age=10;

p1 point =&msg1;

//msg2作为结构B的变量

struct B{

int age;

char s;

}msg2,*p2 = new B;

msg2.age = 3;

p2->age=4;

//

cout<<(*point).age<<endl<<msg2.age;

//

cin>>x;

}

【typedef_struct与struct之间的区别】相关文章:

浅析int*p[ ]与int(*p)[ ]的区别

QString和char以及string之间的赋值详解

C++中继承与组合的区别详细解析

iostream与iostream.h的区别详细解析

C与C++中结构体的区别

枚举和宏的区别详细解析

深入C++中struct与class的区别分析

c字符串,string对象,字符串字面值的区别详解

strcat函数与strncat函数的深入分析

string,CString,char*之间的转化

精品推荐
分类导航