Is it possible to have two main functions in a c program?

W

Walter Roberson

Robbie Hatley said:
Walter Roberson wrote:
ISO/IEC 9899:1999 (E) section 5.1.2.2.1 :
5.1.2.2.1 Program startup
It shall be defined with a return type of int and with no
parameters:
or with two parameters (referred to here as argc and argv,
or equivalent;9) or in some other implementation-defined manner.

Your posting to which I replied said "There must be exactly ONE main,
with one of these two signatures" You missed that last part "or in some
other implementation-defined manner", which allows for the
possibility of other signatures.

Now, you can try to violate that by having functions called
"main" in two different modules

"try"?? I showed source code!

Your amended answer should therefore not have been
"No. You might be able to trick it, but don't do that"; it should
instead have been "Yes, you can trick it -- but don't do that".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top