struct结构体基础知识
来源:互联网 发布:vb连接oracle 编辑:程序博客网 时间:2024/06/07 03:52
/* ============================================================================ Name : TestStruct.c Author : lf Version : Copyright : Your copyright notice Description : struct结构体基础知识 ============================================================================ */#include <stdio.h>#include <stdlib.h>//定义全局stundent结构体struct stundent {char name;int age;};int main(void) {testStruct1();return EXIT_SUCCESS;}/** * 结构体的基本使用 */void testStruct1() {//使用全局结构体struct stundent s;s.name = 'A';s.age = 18;printStructInfo(s);printf("name=%c,age=%d\n", s.name, s.age);printf("=================\n");//定义局部teacher结构体struct teacher {char name;int age;};struct teacher t;t.name = 'B';t.age = 35;printf("name=%c,age=%d\n", t.name, t.age);printf("=================\n");//如下亦可初始化结构体,但是可读性不强struct teacher te={'C',55};printf("name=%c,age=%d\n", te.name, te.age);}void printStructInfo(struct stundent s){printf("name=%c,age=%d\n", s.name, s.age);}
0 0
- struct结构体基础知识
- C#基础知识之结构体(Struct)
- 结构体(struct) 用法
- 结构体struct module
- 什么结构体 struct
- struct结构体
- struct hostent结构体
- struct hostent结构体
- struct termios结构体
- struct hostent结构体
- 结构体(struct)
- struct termios结构体
- struct device结构体(
- [Matlab]结构体(Struct)
- struct termios结构体
- struct termios 结构体
- struct device结构体
- struct timeval结构体
- 【Java加密解密】PBE算法
- 【JavaScript】JavaScript的对象-对象专门语句
- Windows下QT Creator配置protobuf
- RMQ问题的Sparse-Table算法
- 将Python脚本文件包装成可执行文件
- struct结构体基础知识
- 关于IOS数据操作方式详解(一)— XML数据解析
- [转]Android 颜色代码大全
- UVA - 10626 Buying Coke(记忆化搜索)
- UVa 11991 - Easy Problem from Rujia Liu?
- Python3.4 控制台窗口隐藏
- How to Program in C++
- SpringMVC + spring3.1.1 + hibernate4.1.0 集成及常见问题总结
- Mac下eclipse安装SVN插件