我自信此c程序无问题,可就是报错,怎么回事?
来源:百度知道 编辑:UC知道 时间:2024/07/02 11:58:34
#include "stdio.h"
void fun1()
{
printf("I am in fun1 now.");
fun2();
}
void fun2()
{
printf("I am in fun2 now.");
}
void main()
{
printf("I am in main now.");
fun1();
printf("I am in main now.");
}
error C2065: 'fun2' : undeclared identifier
error C2373: 'fun2' : redefinition; different type modifiers
warning C4551: function call missing argument list
void fun1()
{
printf("I am in fun1 now.");
fun2();
}
void fun2()
{
printf("I am in fun2 now.");
}
void main()
{
printf("I am in main now.");
fun1();
printf("I am in main now.");
}
error C2065: 'fun2' : undeclared identifier
error C2373: 'fun2' : redefinition; different type modifiers
warning C4551: function call missing argument list
#include "stdio.h"
void fun2()
{
printf("I am in fun2 now.");
}
void fun1()
{
printf("I am in fun1 now.");
fun2();
} /* fun1和 fun2调换下 */
void main()
{
printf("I am in main now.");
fun1();
printf("I am in main now.");
getchar(); /* 如果是在win-tc中编程,需加该语句;否则删掉*/
}
先定义后使用,你在FUN1中调用的FUN2还没有定义,无法调用。你得先在主函数中定义才行。
你fun2()在fun1()要提前声明,或者放在fun1()前面写,因为你fun1()已经用到了fun2()了
undeclared identifier 没有声明 好好学习点英语吧
没有声明