// 结构体和函数,形参问题.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include <stdio.h>
#include <string.h>
struct Student
{
int age;
char sex;
};
void InStudent(struct Student *);//输入结构体数据
void OutStudent(struct Student);//输出结构体数据,形参也可以是指向结构体的指针变量
int main(void)
{
struct Student st;
InStudent(&st);
OutStudent(st);
return 0;
}
void InStudent(struct Student *pstu)
{
pstu->age = 100;
pstu->sex = 'f';
}
void OutStudent(struct Student ss)
{
printf("%d,%c\n", ss.age, ss.sex);
}
结构体与函数,形参问题
最新推荐文章于 2024-09-28 17:42:39 发布