Thread: exiting instantly

  1. #1

    Question exiting instantly

    if a function returns type data bool and we want to exit the program without returning to main(). what's the syntax?

  2. #2
    Registered User Cela's Avatar
    Join Date
    Jan 2003
    #include <cstdlib>


  3. #3


    whats that EXIT_STATUS?

  4. #4
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    An integer exit status. 0 normally indicates success, anything else is some kind of informational error code. If you are not interested in the value, say exit(1). Be careful.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  5. #5
    Registered User Cela's Avatar
    Join Date
    Jan 2003
    >>whats that EXIT_STATUS?
    A value that I have no way of guessing since you didn't mention what operating system/compiler you use. It's meant to be read as "Insert your favorite exit status here". :-)

  6. #6
    Registered User
    Join Date
    Sep 2002
    Just wanted to say that exiting somewhere IN the program is
    a bad thing. If you ever want to go more advanced programming
    (win32,OpenGL) you'lle notice that you can't just exit somewhere,
    But need to send a signal back to main so it exits from main.

    Anyway for console apps it doesn't cause any trouble to exit
    anywhere just wanted you to know.


  7. #7
    even doing this in a basic windows app will mess things up. Memory leaks are only the tip of the iceberg of side effects.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Pausing before exiting function?
    By Matus in forum C Programming
    Replies: 3
    Last Post: 10-21-2008, 03:00 PM
  2. Exiting the program.
    By Taka in forum C Programming
    Replies: 6
    Last Post: 10-14-2007, 09:24 AM
  3. exiting program
    By ypramesh in forum C Programming
    Replies: 2
    Last Post: 04-01-2006, 03:27 PM
  4. Ask user to save file before exiting.
    By Bajanine in forum Windows Programming
    Replies: 3
    Last Post: 11-15-2004, 06:34 PM
  5. prevent exiting
    By Unregistered in forum A Brief History of
    Replies: 4
    Last Post: 12-12-2001, 02:57 PM