geo*_*tnz 10
你应该总是有一些干净利落的方式.我建议将代码移到另一个函数,该函数返回一个标志,说明是否退出.
int main(int argc, char*argv[])
{
// param parsing, init code
while (DoStuff());
// cleanup code
return 0;
}
int DoStuff(void)
{
// code that you would have had in main
if (we_should_exit)
return 0;
return 1;
}
Run Code Online (Sandbox Code Playgroud)