Thread: Way use return 0 ?!!

  1. #1
    Registered User
    Join Date
    Dec 2001

    Way use return 0 ?!!

    hi guys

    can i know way do we use return 0
    in the main function.

    what it's function ?

    thanx for all.

  2. #2
    Registered User Vber's Avatar
    Join Date
    Nov 2002
    Why we return 1 in the main function?
    Cuz if we declared the main function like this: int main() so this says, we need to return an integer an the end of the function, and this is what return 0 do.

    What is a function? search on the forum, or google, sure you'll find an answer.

  3. #3
    Registered User Azuth's Avatar
    Join Date
    Feb 2002
    A return code is used by functions to signal either success or failure. Functions declared with void don't return anything, and this is fine inside your program if you don't want to know if that function succeeded. The operating system however is always expecting a return code, which is why main should return an integer. Returning 0 is standard for success.
    Demonographic rhinology is not the only possible outcome, but why take the chance

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Another weird error
    By rwmarsh in forum Game Programming
    Replies: 4
    Last Post: 09-24-2006, 10:00 PM
  2. Why only 32x32? (OpenGL) [Please help]
    By Queatrix in forum Game Programming
    Replies: 2
    Last Post: 01-23-2006, 02:39 PM
  3. OpenGL Window
    By Morgul in forum Game Programming
    Replies: 1
    Last Post: 05-15-2005, 12:34 PM
  4. opengl help
    By heat511 in forum Game Programming
    Replies: 4
    Last Post: 04-05-2004, 01:08 AM
  5. Algorithm to walk through a maze.
    By Nutshell in forum C Programming
    Replies: 30
    Last Post: 01-21-2002, 01:54 AM