warning C4700: local variable 'x' used without having been initialized 求高手解释#include"stdio.h"void main(){int x,y;if (x>y)printf("%d",x);else printf("%d",y);}

来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/20 00:37:57
warningC4700:localvariable''x''usedwithouthavingbeeninitialized求高手解释#include"stdio.h"voidmain(){intx,

warning C4700: local variable 'x' used without having been initialized 求高手解释#include"stdio.h"void main(){int x,y;if (x>y)printf("%d",x);else printf("%d",y);}
warning C4700: local variable 'x' used without having been initialized 求高手解释
#include"stdio.h"
void main()
{
int x,y;
if (x>y)
printf("%d",x);
else
printf("%d",y);
}

warning C4700: local variable 'x' used without having been initialized 求高手解释#include"stdio.h"void main(){int x,y;if (x>y)printf("%d",x);else printf("%d",y);}
这只是一个警告,但还是可以运行的.
意思是你的x和y没有初始值.
#include"stdio.h"
void main()
{
\x09int x,y;
\x09x=0;
\x09y=0;
\x09if (x>y)
\x09printf("%d",x);
\x09else
\x09printf("%d",y);
}
这样就没有警告了,当然运行之后自己随便赋值也行,要这样写:
#include"stdio.h"
void main()
{
\x09int x,y;
\x09scanf("%d%d",&x,&y);
\x09if (x>y)
\x09printf("%d",x);
\x09else
\x09printf("%d",y);
}
你运行时候输入 x的数值 空格 y的数值 回车就出结果了