
- Forum
- Programming Talk
- C and C++
- without main function how can we run c program
without main function how can we run c program
This is a discussion on without main function how can we run c program within the C and C++ forums, part of the Programming Talk category; Hi How can we run a " C Langauge program without writing the main function It is possible to do ...
-
02-03-2007, 02:06 AM #1
- Join Date
- Feb 2007
- Answers
- 2
without main function how can we run c program
Hi
How can we run a " C Langauge program without writing the main function
It is possible to do it. but can anyone explain this with an example?
-
When a C program is executed the main() is the function called by the run-time environment. But it is possible to write C program without main() function with some trick. I have not done this but will make a try and let you know. Nice question posted which triggered me to try this out.
-
03-15-2007, 11:24 PM #3
- Join Date
- Mar 2007
- Answers
- 5
-
07-08-2008, 06:45 AM #4
- Join Date
- Jul 2008
- Answers
- 1
without main function how can we run c program
#include<stdio.h>
#define decode(s,t,u,m,p,e,d) m##s##u##t
#define begin decode(a,n,i,m,a,t,e)
int begin()
{
printf(" hello ");
}
-
I disagree - clever though.
That's still has a main function. If you trace through what the #define's are doing it's just changing "begin()" to "main()". The compiler still sees and compiles "main()".
It sounded like Dharmesh rathod wanted no main function whatsoever rather than obfuscated code.
-
08-01-2008, 08:01 AM #6
- Join Date
- Aug 2008
- Answers
- 2
-
As I know its not possible to run a program without the main function.
-
Sponsored Ads

Reply With Quote
..........................................................





