Thread: main()

  1. #1


    Has anyone ever tried to make this a data type besides int or void? Like this:

    char main()
    double main()
    What will people say if they hear that I'm a Jesus freak?
    What will people do if they find that it's true?
    I don't really care if they label me a Jesus freak, there is no disguising the truth!

    Jesus Freak, D.C. Talk


  2. #2
    Registered User
    Join Date
    Nov 2001

    The ANSI standard for the main function is:-

    int main(int argc, char *argv[])

    ie returns an integer. This is why the main function always terminates with return 0;

    a lot of compilers allow you to miss out the return data type and just declare main(), and some compilers (wrongly) allow you to declare main as void.

    I suspect that if you tried to return a character (if it got past the compiler) the os would interpret it as an integer and throw up an error message.


    mmmmmmmm... iterations

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Why To Use int main()
    By year2038bug in forum C Programming
    Replies: 2
    Last Post: 08-19-2005, 01:28 PM
  2. passing params to main()
    By mike11 in forum C++ Programming
    Replies: 14
    Last Post: 06-21-2005, 12:36 PM
  3. pointers
    By InvariantLoop in forum C Programming
    Replies: 13
    Last Post: 02-04-2005, 09:32 AM
  4. Int Main or Void Main?
    By FromHolland in forum C++ Programming
    Replies: 9
    Last Post: 06-12-2003, 04:29 PM
  5. int main (), main (), main (void), int main (void) HELP!!!
    By SmokingMonkey in forum C++ Programming
    Replies: 7
    Last Post: 05-31-2003, 09:46 PM