Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C 在提示您做出选择后,我希望让我的处理函数使程序停止执行,如下面的代码所示_C - Fatal编程技术网

C 在提示您做出选择后,我希望让我的处理函数使程序停止执行,如下面的代码所示

C 在提示您做出选择后,我希望让我的处理函数使程序停止执行,如下面的代码所示,c,C,这不会终止您的程序。尝试使用exit(0)改为请格式化代码,使其可读。还请添加文本详细描述问题,并提出具体问题。 include include include void handler(int n) { int x; char ch; printf("Are you sure you want to Quit?\n"); if(scanf("%c",&ch)=='y'){ return 0; } } int main() { signal(

这不会终止您的程序。尝试使用
exit(0)改为

请格式化代码,使其可读。还请添加文本详细描述问题,并提出具体问题。
include
include
include
void handler(int n) {
    int x;
    char ch;
    printf("Are you sure you want to Quit?\n");
    if(scanf("%c",&ch)=='y'){ return 0; }

}

int main() {

    signal(SIGTSTP, handler);   // ^Z at keyboard
    for(;;){ }

}
return 0;