Thread: Stupid Question

  1. #1
    Registered User
    Join Date
    Oct 2004

    Question Stupid Question

    Ok, I just started programming and I feel like a complete idiot

    So I started the first lesson and it went easy. Well now I'm sorta confused on something. Like let's say I made the program "Hello World" Well it said that it will return the integer 0 at the end bracket and 0 means it completed succesfully. Well I did return 1 and it still completes successfully. I know it's probably really stupid but I'm sorry. Please help me

  2. #2
    Registered User jlou's Avatar
    Join Date
    Jul 2003
    The program can return whatever you want it to. You, the programmer, decide.

    Normally, you make it return 0 to show that it was successful, because that is the convention, 0 means success, non-zero means some sort of error. But you don't have to follow the convention. So whether or not the program executed the way you wanted it to is completely separate from what it returns.

  3. #3
    Toaster Zach L.'s Avatar
    Join Date
    Aug 2001
    The return value of main is mainly there to for other programs or scripts that may run your program, and want to know if everything went alright. It is never actually used for anything by the program that returns it (as it happens at the completion of the program).
    The word rap as it applies to music is the result of a peculiar phonological rule which has stripped the word of its initial voiceless velar stop.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Stupid Question Probably
    By Kyrin in forum C Programming
    Replies: 2
    Last Post: 05-07-2006, 12:51 AM
  2. Replies: 7
    Last Post: 11-04-2005, 12:17 AM
  3. Stupid Question
    By digdug4life in forum C++ Programming
    Replies: 22
    Last Post: 05-17-2005, 11:43 AM
  4. stupid, stupid question
    By xelitex in forum C++ Programming
    Replies: 5
    Last Post: 12-22-2004, 08:22 PM
  5. Stupid question: What does Debugger do?
    By napkin111 in forum C++ Programming
    Replies: 6
    Last Post: 05-02-2002, 10:00 PM