struct与typedef
2015-08-25 10:26
148 查看
分下面几种情形来讲
1.struct Student{
int a;
int b;
}
在c++中,Student是一个类型,可以直接申明 这个变量进行访问,比如Student a;但在c语言中,Student是一个临时命名,不是一个类型,struct Student才是一个类型。对申明这样的一个类型需要在前面加上关键字struct。比如struct Student a;
2.typedef struct Student{
int a;
int b;
}Stu;
像这种前面添加typedef关键字的,
在c语言中, 申请这个结构变量可以:
1).struct Student a
2).Stu a;
在C++中,可以用下面这三种方式:
1).struct Student a
2).Stu a;
3)Student a
1.struct Student{
int a;
int b;
}
在c++中,Student是一个类型,可以直接申明 这个变量进行访问,比如Student a;但在c语言中,Student是一个临时命名,不是一个类型,struct Student才是一个类型。对申明这样的一个类型需要在前面加上关键字struct。比如struct Student a;
2.typedef struct Student{
int a;
int b;
}Stu;
像这种前面添加typedef关键字的,
在c语言中, 申请这个结构变量可以:
1).struct Student a
2).Stu a;
在C++中,可以用下面这三种方式:
1).struct Student a
2).Stu a;
3)Student a
相关文章推荐
- SpringMVC单元测试
- cuckoo相关
- iOS开发之多图片无缝滚动组件封装与使用
- asp.net 文件下载(txt,rar,pdf,word,excel,ppt)
- eclipse 插件安装
- 黑马程序员-学习笔记-多线程
- JS 实现带回调倒计时器
- 总结系列-Android的文件系统
- lvs+keepalived 负载均衡keepalived.conf配置
- Command-cat, tac, file, history, tree,tee…
- 数组类型 out类型
- Ubuntu系统下的Hadoop集群(7)_设置Linux环境变量的方法和区别
- img如何在div中垂直居中?要支持所有浏览器
- WebRTC VideoEngine超详细教程(二)——集成OPENH264编解码器
- 'gulp'不是内部或者外部命令,也不是可运行的程序或批处理文件
- django学习(1)编写技巧
- jQuery合作伙伴左右滚动特效
- iOS 万能跳转界面方法 (runtime实用篇一)
- 闭包-简洁版(Swift)
- UML用例图总结