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  指针访问结构体成员

最新文章

  1. mybatis 中的where标签
  2. vs2010中的MSBuild输出warning MSB8012问题
  3. [转]Hibernate时间总结
  4. 百度地图API 关键字模糊搜索
  5. 剑指Offer17 二叉树的镜像
  6. allegro 16.6 空心焊盘的制作
  7. Using Open Source Static Libraries in Xcode 4
  8. html5刮刮卡
  9. UOJ 52 元旦激光炮
  10. 基于visual Studio2013解决算法导论之007优先队列(堆实现)
  11. 手动部署 kubernetes HA 集群
  12. mysql数据据备份与还原
  13. 工具类静态方法注入dao
  14. git小笔记
  15. Oracle 12c的可插拔数据库PDB
  16. related Field has invalid lookup: icontains 解决方法
  17. 雷林鹏分享:Ruby 安装 - Windows
  18. Playrix Codescapes Cup (Codeforces Round #413, rated, Div. 1 + Div. 2) E - Aquarium decoration 贪心 + 平衡树
  19. Asp.Net实现FORM认证的一些使用技巧(必看篇)
  20. 架构师养成记--32.Redis高级(安全 主从复制)

热门文章

  1. java实现发送短信
  2. 解决Oracle 11gR2 空闲连接过多,导致连接数满的问题
  3. [Leetcode][Python]22: Generate Parentheses
  4. 桂林电子科技大学出校流量控制器Android版1.0.0
  5. 【转】Loss Function View
  6. 轻轻谈一下seaJs——模块化开发的利器
  7. HDOJ 4252 A Famous City 单调栈
  8. sublime text 3解放鼠标的快捷键总结
  9. ​c++ 调用DLL函数,出现错误
  10. JavaSE学习总结第13天_API常用对象3