Thread: return type

  1. #1
    Registered User
    Join Date
    Aug 2007
    Posts
    34

    return type

    in c we need not mention return type
    directly we can use main();


    but in c++ we have to mention return type
    ie void main();
    or int main();
    etc why is this so??

  2. #2
    pwns nooblars
    Join Date
    Oct 2005
    Location
    Portland, Or
    Posts
    1,094
    C automatically types as int if no type is provided, if I recall my adventures into C properly. Also void main() is wrong, even if it lets you do it.

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,666
    We did this already - http://cboard.cprogramming.com/showthread.php?t=93015

    If you didn't understand it, then post your concerns on the original thread. Don't just post the same question in the next forum.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Getting an error with OpenGL: collect2: ld returned 1 exit status
    By Lorgon Jortle in forum C++ Programming
    Replies: 6
    Last Post: 05-08-2009, 08:18 PM
  2. New string functions
    By Elysia in forum C Programming
    Replies: 11
    Last Post: 03-28-2009, 05:03 AM
  3. Replies: 0
    Last Post: 03-20-2008, 07:59 AM
  4. Why only 32x32? (OpenGL) [Please help]
    By Queatrix in forum Game Programming
    Replies: 2
    Last Post: 01-23-2006, 02:39 PM
  5. OpenGL Window
    By Morgul in forum Game Programming
    Replies: 1
    Last Post: 05-15-2005, 12:34 PM