Use of exit() function

后端 未结 13 1430
离开以前
离开以前 2020-11-30 23:34

I want to know how and when can I use the exit() function like the program in my book:

#include

void main()
{
    int goals;
            


        
13条回答
  •  悲哀的现实
    2020-12-01 00:00

    Bad programming practice. Using a goto function is a complete no no in C programming.
    Also include header file stdlib.h by writing #include for using exit() function. Also remember that exit() function takes an integer argument . Use exit(0) if the program completed successfully and exit(-1) or exit function with any non zero value as the argument if the program has error.

提交回复
热议问题