C在函数返回语句 [英] the return statement of C in a function
问题描述
我是C语言的一个新手,我有一个关于用C 收益
语句问题:
无效verifyValue(int值)
{
返回;
}无效handleValue(int值)
{
开关(值)
{
情况1:
// 做一点事
打破; 案例10:
verifyValue(值);
// code第1部分的其余部分
打破;
默认:
打破;
}
}诠释的main()
{
INT vlaue = 10;
handleValue(值); // code部分2的其余部分
}
所以 verifyValue()
函数将返回情况下,10
,一旦返回,将$其余C $丙部1继续执行或code部分2的其余部分继续执行,从那里这回在 verifyValue()
真的回来了?
10的情况下:
verifyValue(值);
// code第1部分的其余部分
打破;
verifyValue()
函数被调用,并从该函数返回后
// code部分,其余1
块引用>被执行。
该休息后
执行,所以你出去开关的
结构。后来,控制返回到
的main()
和
// code部分,其余2
块引用>执行
I am a newbie of C language, I have a question about
return
statement in C:void verifyValue(int value) { return; } void handleValue(int value) { switch(value) { case 1: // do something break; case 10: verifyValue(value); // the rest of code part 1 break; default: break; } } int main() { int vlaue = 10; handleValue(value); // the rest of code part 2 }
so the
verifyValue()
function will return incase 10
, once it returns, will the rest of code part 1 continue to execute or the rest of code part 2 continue to execute, from where this return inverifyValue()
really returned?解决方案case 10: verifyValue(value); // the rest of code part 1 break;
verifyValue()
function is called and after returning from that function// the rest of code part 1
is executed. After that
break
is executed so you get out ofswitch
construct.Later the control is returned to
main()
and// the rest of code part 2
is executed.
这篇关于C在函数返回语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!