1 Star 0 Fork 0

李勇震/c语言每日练习

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
test 10.29(结构体练习) 1.64 KB
一键复制 编辑 原始数据 按行查看 历史
李勇震 提交于 2022-10-29 22:11 +08:00 . add test 10.29(结构体练习).
#include<stdio.h>
struct Book
{
char name [20];
short price ;
};
int main()
{
struct Book b1 = { "c语言程序设计",55 };
struct Book* pb = &b1;
printf("%s\n", b1.name);
printf("%d\n", b1.price);
b1.price = 20;
printf("%d", b1.price);
return 0;
}
#include<stdio.h>
struct Book
{
char name[20];
short price;
};
int main()
{
struct Book b1 = { "c语言程序设计",10 };
//struct Book* pb = &b1;
printf("书的名字 %s\n", b1.name);
printf("书的原价 %d\n", b1.price);
b1.price = 20;
printf("书现在的价格 %d", b1.price);
return 0;
}
#include<stdio.h>
struct Stu
{
char name[20];
int age;
char sex[5];
char id[15];
};
int main()
{
struct Stu s = { "张三", 20, "男", "20180101" };
printf("name = %s \nage = %d\nsex = %s \nid = %s\n ", s.name,s.age,s.sex,s.id);
return 0;
}
#include<stdio.h>
struct Book
{
char name [20];
short price ;
};
int main()
{
struct Book b1 = { "c语言程序设计",55 };
struct Book* pb = &b1;
/*printf("%s\n", b1.name);
printf("%d\n", b1.price);*/
b1.price = 20;
printf("%d", b1.price);
return 0;
}
#include<stdio.h>
struct Book
{
char name[20];
short price;
};
int main()
{
struct Book b1 = { "c语言程序设计",10 };
//struct Book* pb = &b1;
printf("书的名字 %s\n", b1.name);
printf("书的原价 %d\n", b1.price);
b1.price = 20;
printf("书现在的价格 %d", b1.price);
return 0;
}
#include<stdio.h>
struct stu
{
char name[20];
int age;
char sex[5];
char id[15];
};
int main()
{
struct stu s = { "张三",20,"男","20180101" };
printf("name %s ", s.name );
return 0;
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C
1
https://gitee.com/liyongzhen2004/2022.10.24.git
git@gitee.com:liyongzhen2004/2022.10.24.git
liyongzhen2004
2022.10.24
c语言每日练习
master

搜索帮助