|
5啊哈币
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- struct ScoLr{
- int xh;
- char* name;
- float sco;
- struct ScoLr* next;
- };
- struct ScoLr* CtJc(){
- int i;
- struct ScoLr *a, *b, *c;
-
- c = NULL;
- b = NULL;
- a = (struct ScoLr*)malloc(sizeof(struct ScoLr));
- printf("输入信息:");
- scanf("%d %s %f", &a->xh,a->name,&a->sco);
- for(i=0;;i++){
- if(a->xh==9999){
- break;
- }
- else{
- if(i==0){
- c = a;
- }
- else{
- b = a;
- a = (struct ScoLr*)malloc(sizeof(struct ScoLr));
- printf("输入信息:");
- scanf("%d %s %f", &a->xh,a->name,&a->sco);
- b->next = a;
- }
- }
- }
- a->next = NULL;
- free(a);
- free(b);
- return c;
- }
- /*(){
-
- }*/
- int main()
- {
- struct ScoLr* head;
- head = CtJc();
-
- return 0;
- }
复制代码 //这篇代码编译不报错,自查了几遍,但没找出问题,希望各位路过的能指点指点,提前谢谢了!
|
|