这是我在代码块 C 语言中的代码 对不起我是新来的
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
struct record
{
char name[50];
char id[30];
char course[7];
char project[100];
char field[3];
char supervisor[30];
};
struct record addname();
void list_func(record);
int main()
{
struct record student1,student2;
student1=addname();
student2=addname();
printf("\n\n\tUNDERGRADUATE PROJECT RECORD SYSTEM");
list_func(student1);
list_func(student2);
getch();
}
struct record addname()
{
struct record system;
printf("\nEnter student's Name: ");
gets(system.name);
printf("Enter matrix's ID: ");
gets(system.id);
printf("Enter course's Name: ");
gets(system.course);
printf("Enter Project Title: ");
gets(system.project);
printf("Enter Field: ");
gets(system.field);
printf("Enter Supervisor's name: ");
gets(system.supervisor);
return (system);
}
void list_func(record list)
{
printf("\n\nStudent's Name: %s",list.name);
printf("\nMatrix ID: %s",list.id);
printf("\nCourse: %s",list.course);
printf("\nProject's Title: %s",list.project);
printf("\nField: %s",list.field);
printf("\nSupervisor: %s",list.supervisor);
printf("\n");
printf("\n------------------------------------------------");
return;
}
好的,这是我的错误:
在第 17 行,
void list_func(record);
在第 50 行,
void list_func(record list)
它说
line 17 warning: parameter names (without types) in function declaration [enabled by default]
line 50 error: Unknown type name 'record'
in function 'main'
line 31 warning: control reaches end of non-void function [-Wreturn=type]
说真的,我不明白为什么会这样。我使用我朋友的编码作为参考并对其进行了一点更改,然后调试失败。我什至在我的代码块项目中复制并粘贴了我朋友的代码,但它仍然无法运行,但它可以在她的代码块项目中完美运行。谁能帮我?我编码不太好