can't we write ac program without main()
By lalithasri
@lalithasri (81)
India
January 24, 2008 2:18am CST
Can't we write a c program with out using main() function.If no how can we write with out using main().
3 responses
@elguiruela (631)
• Japan
24 Jan 08
NO. You cannot write a C program without the main() function.
It is the part of the program where the runtime environment knows where to begin program execution. Your C compiler will always look for that. In other words, ALL C programs must have a main() function.
Regards.
@lalithasri (81)
• India
25 Jan 08
Thank you for your response.
But some of the programs consist of no main() function in that.I dont know how to write it.
@elguiruela (631)
• Japan
28 Jan 08
Well it depends on the language.
If you're talking about C, then definitely there is a main() function.
If there is no main(), then it's not C.
@daudzaid1 (54)
• India
24 Apr 13
Seriuosly , you can't. At least main should be there . or where else you will write your working code ??? If you are thinking of any other function, then you have to call this function through main only . thus you can't write without main
@beep310 (25)
• Togo
3 May 08
You cannot write a working C program without a main() function. It just won't work. However, you can write header files ".h" without the main function. Maybe this is what you are looking for, I don't know. In header files you have to define constants/functions.
Hope this helps