结构体和typedef
2016-05-07 23:33
218 查看
c语言的结构体使用方法:
1. 第一种方法:
声明
声明
typedef其他用法
如:
1. 第一种方法:
声明
struct Person { float weight; float height; }使用
struct Person lloyd; lloyd.weight = 60; lloyd.height = 175;2. 第二种方法,使用typedef
声明
typedef struct { float weight; float height; } Person使用
Person lloyd; //不用写struct了
typedef其他用法
如:
typedef char Line[81]; //定义Line为char[81]的数组 Line haha, hehe; //haha 与 hehe都是char[81]类型上面代码相当于:
char haha[81]; char hehe[81];
相关文章推荐
- C#中结构体和字节数组转换实现
- 解析结构体的定义及使用详解
- C语言中结构体struct编写的一些要点解析
- 详解C语言的结构体中成员变量偏移问题
- c#入门之枚举和结构体使用详解(控制台接收字符串以相反的方向输出)
- 基于typedef的用法详解
- C语言基础知识点解析(extern,static,typedef,const)
- 关于C/C++中typedef的定义与用法总结
- 深入C++ typedef的用法总结(必看)
- C++基础入门教程(三):数组、字符串、结构体、共用体
- C语言typedef与复杂函数声明问题的深入解析
- 解析C语言中结构体struct的对齐问题
- 用typedef定义类型的总结分析
- 详解C语言结构体中的函数指针
- C/C++语言中结构体的内存分配小例子
- typedef和#define的用法以及区别
- C#中使用反射获取结构体实例及思路
- 结构体类型数据作为函数参数(三种方法)
- Go语言里的结构体文法实例分析
- Go语言结构体定义和使用方法