hi , everybody can any one write
a "c" programme without main()
function "please don't tell me
this is not possible "
If u know please tell me

Recommended Answers

All 3 Replies

If by ``"c" programme'' you mean something that is compliant with one or both of the C standards, then there's only one answer: it's impossible. Your not wanting such an answer does not make it less true or correct.

If you wave a magic wand and decree that standard compliance doesn't matter, then the correct answer is whatever you (or anyone else) might define it to be. Microsoft have done this by introducing the WinMain() entry point which, for win32 applications, replaces the main() function. But that solution is specific to Microsoft operating systems and relies on specific compiler extensions that are outside the scope of the C standards.

Yes , replace that piece of code with direct assembly code

hi , everybody can any one write a "c" programme without main()
function "please don't tell me
this is not possible "
If u know please tell me

Of course, it's possible in freestanding environments, see the C Std:

Two execution environments are defined: freestanding and hosted. In both cases, program startup occurs when a designated C function is called by the execution environment.
...
In a freestanding environment (in which C program execution may take place without any benefit of an operating system), the name and type of the function called at program startup are implementation-defined.

See also http://publications.gbdirect.co.uk/c_book/preface/hosted_and_free_standing.html

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.