Difference between exit and exit(0)

monkey_007

monkey_007

@monkey-007-UgQZQk Oct 26, 2024
I would just like to know that what is the difference between exit,exit(0) and exit(1).Please help me.

Replies

Welcome, guest

Join CrazyEngineers to reply, ask questions, and participate in conversations.

CrazyEngineers powered by Jatra Community Platform

  • Vishal Sharma

    Vishal Sharma

    @vishal-pysGmK Oct 5, 2012

    you'll have a better explanation here...
    #-Link-Snipped-#
  • Jeffrey Arulraj

    Jeffrey Arulraj

    @jeffrey-xA7lUP Oct 5, 2012

    exit needs one argument of type integer that means any number in the integer category can be sufficient for it
  • Vishal Sharma

    Vishal Sharma

    @vishal-pysGmK Oct 5, 2012

    jeffrey samuel
    exit needs one argument of type integer that means any number in the integer category can be sufficient for it
    Not agreeing with your answer! PS the link above. you'll have the proper information about it 😀
  • sulochana anand

    sulochana anand

    @sulochana-anand-OrGmKr Oct 5, 2012

    exit and exit 0 or exit with non 0 numbers are used to terminate program.exit 0 is used to terminate without any error.but with nonzero it indicates eroors.for eg if u r trying to open file which is not exist in system then it may be indicated by some numbers like 1 etc.different types of eroor are indicated by diffrent numbers.
  • Aniruddha Varma

    Aniruddha Varma

    @aniruddha-varma-wWzjB7 Oct 19, 2012

    Not just the system, but even manually - you may put exit(1) into your code if you want to exit and also indicate an error to the OS.

    As I know it, most people just use exit(0) to mean that the program has terminated normally.