tags:

views:

78

answers:

2

Possible Duplicate:
C program without main function ?

Can we write a c program without main() which can run and execute?

Please reply...

A: 

No, you can not. You can write a library that will be used from another program. But everything must have a beginning, and 'main' is the beginning of a C program...

(On Windows, the Win32 API specifies a WinMain, but it's the same thing, with a different name.)

florin
That only holds true for hosted implementations; a freestanding implementation can use an entry point other than `main`. See 5.1.2.1, paragraph 1.
John Bode
A: 

No, without the main method, the linker will not know where the start of the data segment in the program will start.

The Elite Gentleman