//stu.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct stu{
char id[10];
int score;
};
struct stu *new_stu()
{
struct stu *s;
s = (struct stu *)malloc(sizeof(struct stu));
return s;
}
void set_id(struct stu *s,char *id)
{
strcpy(s->id,id);
}
char *get_id(struct stu *s)
{
return s->id;
}
stu.h #ifndef STU_H #define STU_H struct stu; extern void set_id(struct stu *s,char *id); extern char *get_id(struct stu *s); extern struct stu *new_stu(); #endif
#include <stdio.h>
#include "stu.h"
int main()
{
//struct stu s;
//s.score = 100;
//struct stu s = {{0}};
struct stu *s;
s = new_stu();
set_id(s, "950621");
char *id = NULL;
id = get_id(s);
printf("设置的id为:%s\n",id);
return 0;
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有