2022-10-12 08:52:03

//    结构体知识
#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<math.h>
#include<string.h>//strcpy-字符串拷贝-库函数-<string.h>
//结构体-我们自己创建出来的一个类型
//例如:要描述一本书需要:书名+作者+出版社+书号
//struct  person {//结构体struct描述一个人
//    char sex[6],name[20],interest[20];
//    int age;
//    double height, weight;
//};
//int main() {
//    struct person a = { "男","it陌辰","写代码",17,178,72};
//    struct person* p = &a;
//    printf("性别:%s\n名字;%s\n兴趣爱好:%s\n年龄:%d\n身高:%.2fcm\n体重:%.2fkg",p->sex,p->name,p->interest,p->age,p->height,p->weight);
//}

//struct book {//创建一个结构体类型
//    char name[200];//C语言程序设计
//    int price;//55
//    char from[100];//二次元陌辰工作室
//};
//int main() {//利用结构体类型-创建一个结构体类型的变量
//    struct book a = { "C语言程序设计",55,"二次元陌辰工作室" };//定义一个a来存放结构
//    strcpy(a.name, "跟着董某人从0到1学JAVA");//strcpy - string copy - 字符串拷贝-库函数-<string.h>
//    struct book* p = &a;
//    //printf("%s\n%d\n\t",( * p).name,(*p).price);//有点麻烦
//    //printf("书名:%s\n\t价格:%d元\n",a.name,a.price);
//            //.            结构体变量.成员
//            //->        结构体指针->成员
//    printf("书名:%s\n价格:%d元\n出版社:%s", p->name, p->price, p->from);//建议用箭头->,方便快捷
//    return 0;
//}

    
//int main()//指针变量的使用
//{
//    int a = 10;
//    int* p = &a;//32-4    64-8
//    *p=20;
//    printf("%d,%d",*p,sizeof(p));
//    return 0;
//}

最新文章

  1. js中数组遍历for与for in区别(强烈建议不要使用for in遍历数组)
  2. JDK1.5新特性
  3. 02/07/2106 @ 6:28am (UTC)
  4. Power Map 入门
  5. iOS开发--应用程序上线
  6. NSArray和NSMutableArray的详解
  7. winphone 开发学习笔记(2)
  8. JQuery图片轮换 nivoSlider图片轮换
  9. 真正的手机破解wifi密码,aircrack-ng,reaver,仅限mx2(BCM4330芯片)
  10. linux c中select使用技巧
  11. 2016&quot;百度之星&quot; - 资格赛(Astar Round1) Problem D
  12. Django 学习笔记(二)
  13. JPush简单Java服务端案例实现
  14. 全志A33开发板的安卓控制LED-2-JNI基础
  15. 【转】设置 vim 显示行号永久有效
  16. 如何将maven的jar项目简单快速的转变成war项目
  17. linux因勿删或误操作导致登录界面异常,命令无法使用,显示/bin/bash:No such file or directory
  18. hdu 5099 简单模拟(比较型号)
  19. 自定义 iPhone 铃声
  20. Datatable数据分组

热门文章

  1. 2500-使用MyBatis操作MySQL进行批量更新的注意事项
  2. html的基础01
  3. Spring 常见面试题总结 | JavaGuide
  4. 基于微前端qiankun的多页签缓存方案实践
  5. C#里如何简单的校验时间格式
  6. CentOS7桥接模式上不了外网的配置
  7. 6.13 NOI 模拟
  8. linux-0.11分析:boot文件 head.s 第三篇随笔
  9. React报错之`value`&#160;prop on&#160;`input`&#160;should not be null
  10. 如何实现 System.out.println(&quot;a&quot;) 显示 b