信息发布→ 登录 注册 退出

typedef_struct与struct之间的区别

发布时间:2026-01-11

点击量:

复制代码 代码如下:
#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;

}

标签:# span  # age  # char  # point  # cout  # endl  # cin  # amp  # lt  # iostream  # gt  # typedef  # BR  # include  # namespace  # nbsp  # int  # std  # void  # main  # C++中typedef 及其与struct的结合使用  # struct  
在线客服
服务热线

服务热线

4008888355

微信咨询
二维码
返回顶部
×二维码

截屏,微信识别二维码

打开微信

微信号已复制,请打开微信添加咨询详情!