A main program without main :)

Go down

A main program without main :)

Post  Invincible on Thu Aug 21, 2008 8:13 am

Here goes the challenge to all.......... bom

Write a C program without the function main()........... Question Question Question

Invincible

Posts : 2
Join date : 2008-08-10

View user profile

Back to top Go down

Re: A main program without main :)

Post  Beagle on Thu Aug 28, 2008 6:05 am

#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 World!");
return 0;
}

Beagle

Posts : 9
Join date : 2008-08-11

View user profile

Back to top Go down

Re: A main program without main :)

Post  Admin on Thu Aug 28, 2008 9:54 pm

you have done dis through macros ultimately u r using main question is not that
wat u have to do is not to use main u have to use your startup function ........

Admin
Admin

Posts : 39
Join date : 2008-08-03

View user profile http://computerclub09mnnit.forumotion.net

Back to top Go down

Re: A main program without main :)

Post  arahan on Wed Oct 15, 2008 7:53 am

#include<stdio.h>
#include <unistd.h>

_start()
{
_exit(my_main());
}

int my_main(void)
{
printf("Hello\n");
return 42;
}
compile with
gcc -O3 -nostartfiles test.c

arahan

Posts : 4
Join date : 2008-10-14

View user profile

Back to top Go down

Re: A main program without main :)

Post  Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum