#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define max_number 20
struct student{
int number;
char name[max_number];
char gender[max_number];
char banji[max_number];
struct score *head;
struct student *next;
};
typedef struct student stu;
struct score{
char number[max_number];
char name[max_number];
double fenshu;
struct score *next;
};
typedef struct score sco;
stu* file_to_cpp(FILE *fp,stu *head){
int n,m,i,j;
char str1[50],str2[50],str3[50];
stu *stu_r,*stu_s;
sco *sco_r,*sco_s;
head=(stu*)malloc(sizeof(stu));
fp=fopen("C:\\Users\\Administrator\\Desktop\\student1.txt","a+");
fscanf(fp,"%d %d",&n,&m);
fscanf(fp,"%s %s",str1,str2);
fscanf(fp,"%s %s",str1,str2);
for(i=0;i<m;i++){
fscanf(fp,"%s %s %s",str1,str2,str3);
}
stu_r=head;
for(i=0;i<n;i++){
stu_s=(stu*)malloc(sizeof(stu));
fscanf(fp," %d",&stu_s->number);
fscanf(fp," %s",stu_s->name);
fscanf(fp," %s",stu_s->gender);
fscanf(fp," %s",stu_s->banji);
stu_s->head=(sco*)malloc(sizeof(sco));
sco_r=stu_s->head;
for(j=0;j<m;j++){
sco_s=(sco*)malloc(sizeof(sco));
fscanf(fp," %s",sco_s->number);
fscanf(fp," %s",sco_s->name);
fscanf(fp," %lf",&sco_s->fenshu);
sco_r->next=sco_s;
sco_r=sco_r->next;
}
sco_r->next=NULL;
stu_r->next=stu_s;
stu_r=stu_r->next;
}
stu_r->next=NULL;
fclose(fp);
return head;
}
int main(int argc, char *argv[]) {
FILE *fp;
int n,m;
printf("欢迎使用学生成绩管理系统!\n");
if((fp=fopen("C:\\Users\\Administrator\\Desktop\\student1.txt","r"))==NULL)
{
initialization(fp);
printf("系统初始化成功!\n");
}
stu *head;
head=file_to_cpp(fp,head);
menu_all(head);
return 0;
}
C语言assignment makes pointer from integer without a cast怎么消除警告
有时会出现assignment makes pointer from integer without a cast,有时不会
希望对您有帮助,盼采纳:https://blog.csdn.net/it_xiangqiang/category_10581430.html