C语言关于调用函数,为什么这样不行?
来源:百度知道 编辑:UC知道 时间:2024/05/20 00:12:54
#include <stdio.h>
void main()
{
void menu() ;
menu();
}
void menu()
{printf("Management for Student's scores\n1.Append\n2.List\n3.Search\n4.Sort\n0.Exit\nPlease input your choice\n");}
这样编译没错
如果是这样
#include <stdio.h>
void main()
{
void menu() ;
menu();
void hello();
hello();
}
void menu()
{printf("Management for Student's scores\n1.Append\n2.List\n3.Search\n4.Sort\n0.Exit\nPlease input your choice\n");}
void hello()
{printf("hello\n");}
就有错呢?
void main()
{
void menu() ;
menu();
}
void menu()
{printf("Management for Student's scores\n1.Append\n2.List\n3.Search\n4.Sort\n0.Exit\nPlease input your choice\n");}
这样编译没错
如果是这样
#include <stdio.h>
void main()
{
void menu() ;
menu();
void hello();
hello();
}
void menu()
{printf("Management for Student's scores\n1.Append\n2.List\n3.Search\n4.Sort\n0.Exit\nPlease input your choice\n");}
void hello()
{printf("hello\n");}
就有错呢?
menu();
void hello();
这两句的顺序调换一下即可,即修改如下:
#include <stdio.h>
void main()
{
void menu() ;
void hello();
menu();
hello();
}
void menu()
{printf("Management for Student's scores\n1.Append\n2.List\n3.Search\n4.Sort\n0.Exit\nPlease input your choice\n");}
void hello()
{printf("hello\n");}