Yes, of course. Win32 programmers do it all the time. C implementations which specify an entry point other than main are generally called "freestanding" implementations, and requirements on them are far less severe than on hosted implementations, this laxity over the name of the entry point being one example of the lower requirements. (In Win32 programs, the entry point is typically called WinMain.) A more common situation in which we write C code without main() is when we're writing a code library, rather than an actual program. The library is built separately, without main(), and then linked to whichever programs wish to use it.
"www.anvaypatil" <[EMAIL PROTECTED]> wrote: --- In [email protected], "Nico Heinze" <[EMAIL PROTECTED]> wrote: > > --- In [email protected], Nigel Duckworth <ntype@> 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 > hi, i am Anvay ; the complier need to know from where to start to run the program when you are using it not only c,c++, else other languages like java,cobol,fortrun require to know where to start . basicaly, main() is a sequence of operation to be performed when you just have oops(object oriented programming ) contaning multiple object codes main() decide the sequence so ,c program wihtout main() is a idiotic think !!!!! IT IS TRUE WHEN YOU KANOW PREPROCESSER DERICTIVES TO PROGRAM YOUR COMPILER!!! Regards ================== Mr.Shantibhushan Sale Software Developer Fortuna Technologies Pvt Ltd, Hyderabad --------------------------------- Check out the all-new Yahoo! Mail beta - Fire up a more powerful email and get things done faster.
