#include <stdio.h>
#include <string.h>
int input(struct student *pst);
int output(struct student *pst);
typedef struct student //定义了一个结构体数据类型
{
int num;
char name[50];
int age;
};
int main(void)
{
student st;
input(&st);
output(&st);
}
int input(struct student *pst)
{
pst->num=88;
strcpy(pst->name,"guo");//字符串赋值用strcpy 不能直接赋值
pst->age =16;
return 0;
}
int output(struct student *pst)
{
printf("%d %s %d \n",pst->num ,pst->name ,pst->age );
return 0;
}
网友评论