当前位置:网站首页>7.18(7)
7.18(7)
2022-08-03 05:11:00 【tt142】
今天跟着老师一起写了一些函数,课上有四个练习题,都是之前写过的循环之类的,今天用自定义函数写出来
课上还补充了结构体的知识,之前自学的时候没有学过
下面是一个自己写并且能跑的简单结构体
结构体就是用来描述一个复杂的研究对象的一些信息
#include <stdio.h>
struct MAN
{
char name[10];
char sex[10];
int age;
char id[20];
};
int main()
{
struct MAN s = { "dan","female",3,"12345678" };
printf("%s %s %d %s", s.name, s.sex, s.age, s.id);
return 0;
}
struct MAN
{
char name[10];
char sex[10];
int age;
char id[20];
};
void print(struct MAN* ps)
{
printf("%s %s %d %s", ps->name, ps->sex, ps->age, ps->id);
}
int main()
{
struct MAN s = { "dan","female",3,"12345678" };
print(&s);
return 0;
}
边栏推荐
猜你喜欢
随机推荐
celery工作原理图
Makefile介绍
High availability, two locations and three centers
Talking about GIS Data (6) - Projected Coordinate System
1058 选择题 (20 分)(C语言)
Object类与常用API
Junit
高可用 两地三中心
Tag stack - stack monotonically preparatory knowledge - lt. 739. The daily temperature
tag单调栈-单调栈预备知识-lt.739. 每日温度
vim命令
Flask的简单介绍及使用方法简介
1060 爱丁顿数 (25 分)
typescript44-对象之间的类兼容器
Length n of condensed distance matrix ‘y‘ must be a binomial coefficient
Newifi路由器第三方固件玩机教程,这个路由比你想的更强大以及智能_Newifi y1刷机_smzdm
力扣561. 数组拆分
-钞票兑换-
FileZilla 搭建ftp服务器
web安全-sql注入漏洞