Results 1 to 4 of 4

Thread: Using MAIN

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 2002
    Location
    The Netherlands
    Posts
    96

    Using MAIN

    How many times can I use MAIN in my C++ program?

    Can I declare it as a variable and use it?

    As main() is only one time allowed...

  2. #2
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    You can use MAIN if you want, since it's not main (case-sensitive).

    Why, though? Also, most coding conventions have anything in ALL CAPITALS as either a preprocessor macro, or a constant of some kind.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Aug 2002
    Location
    The Netherlands
    Posts
    96

    Questions..

    Its one of the questions my brother gets at some exam tomorrow...

  4. #4
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Well, you can use MAIN as a function, variable, whatever, if you wanted. You could still only use that name once though (within the same namespace).
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width