exit function in C - exit() in C - C exit Program



 exit() in c language

Learn C - C tutorial - exit() in c - C examples - C programs

exit() in C

  • The exit function calls all functions registered with atexit and terminates the program. File buffers are flushed, streams are closed, and temporary files are deleted.

Syntax

void exit(int status);

Sample Code

#include <stdio.h>
#include <stdlib.h>
int main()
{
    printf("statement-1\n");
    printf("statement-2\n");
    exit(0);
    printf("statement-N\n");
    return 0;
}

Output

statement-1
statement-2


View More Quick Examples


Related Searches to exit function in C - exit() in C - C exit Program