--- In [email protected], Nigel Duckworth <[EMAIL PROTECTED]> wrote:
>
> Hello, this is my first post here.
> 
> I don't believe you can run a C program without main( ) but either 
> way... please explain why you would need to?
> 
> Regards,
> 
> Nigel
> 
> subbu680 wrote:
> >
> > hello frenz
> > can we run a cprogram without main( )?
> > if yes i need code

Some compilers allow you to do this, but it's by no means a
standardised feature of C/C++.
Such sort of questions is often asked in interviews when applying for
a job as a software developer. The best answer (in my opinion) is what
Thomas Hruska, owner of this group, has posted quite some time ago:

"In compiler xyz, version a.b.c, this can be done with a #pragma main
<or whatever particular solution you know of for sure>. However, this
is bad practice as it is in no way standardised and by no means
conformant to any major C/C++ standards. So I avoid this sort of
features if at all possible; using such tricks refrains me from
writing clean, safe, secure, stable, and portable code. And except in
very special situations I don't see any need for such a feature. So if
I may ask you: why do you need such features?"

O.k., the last sentence was not a quote from Thomas, but it can easily
show you whether your counterpart might be trustworthy at all; if they
react in a hostile manner, forget this company; sooner or later
working for this company will kill you because such managers do a bad
job and don't value their employees.

Regards,
Nico

Reply via email to