Tuesday, September 2, 2008

C program without main()

#include
#define decode(s,e,l,v,a,m,c) v##a##l##e
#define begin decode(a,n,i,m,a,t,e)
int begin()
{
printf(" hello,this is a C program without main() from selvam");
}
Explanation:
Look above,though visibly there is no main(),but indirectly calls main() by the use of macro substitution.
begin()->decode(a,n,i,m,a,t,e)()->main()
note that,simple substitution is taking place...4,5,3,2 is oreder of parameter evaluation!
thats it ok...i guess it is not possible to write c program without main()(directly or indirectly)
from s.selvam

No comments: