c 结构体struct
2024-10-13 14:44:02
struct 定义初始化
#include<stdio.h> typedef struct stuInfo
{
char stuName[]; //姓名
int stuId; //学号
int age; //年龄
char sex; //性别
}stuInfos; //给结构体取别名 struct stuInfo s1 等于 stuInfos s2; int main(void)
{
stuInfos stu = {"zhangsan",,,'M'};//初始化
// stu.stuName = "zhangsan";错误 数组不能被直接赋值
strcpy(stu.stuName,"zhangsan");
sprintf(stu.stuName,"%s","zhangsan");
puts(stu.stuName); //用.来访问结构体成员
}
结构体指针
struct stuinfo *p = NULL; sruct stuinfo stu; p = &stu; //stu 不是结构体的首地址 p->name = *p.name 指针访问结构体成员
最新文章
- mybatis 中的where标签
- vs2010中的MSBuild输出warning MSB8012问题
- [转]Hibernate时间总结
- 百度地图API 关键字模糊搜索
- 剑指Offer17 二叉树的镜像
- allegro 16.6 空心焊盘的制作
- Using Open Source Static Libraries in Xcode 4
- html5刮刮卡
- UOJ 52 元旦激光炮
- 基于visual Studio2013解决算法导论之007优先队列(堆实现)
- 手动部署 kubernetes HA 集群
- mysql数据据备份与还原
- 工具类静态方法注入dao
- git小笔记
- Oracle 12c的可插拔数据库PDB
- related Field has invalid lookup: icontains 解决方法
- 雷林鹏分享:Ruby 安装 - Windows
- Playrix Codescapes Cup (Codeforces Round #413, rated, Div. 1 + Div. 2) E - Aquarium decoration 贪心 + 平衡树
- Asp.Net实现FORM认证的一些使用技巧(必看篇)
- 架构师养成记--32.Redis高级(安全 主从复制)
热门文章
- java实现发送短信
- 解决Oracle 11gR2 空闲连接过多,导致连接数满的问题
- [Leetcode][Python]22: Generate Parentheses
- 桂林电子科技大学出校流量控制器Android版1.0.0
- 【转】Loss Function View
- 轻轻谈一下seaJs——模块化开发的利器
- HDOJ 4252 A Famous City 单调栈
- sublime text 3解放鼠标的快捷键总结
- ​c++ 调用DLL函数,出现错误
- JavaSE学习总结第13天_API常用对象3