Write 'C' Program without main function...? RRS feed

  • Question

  • Hi friends try to create a program without a main() ..... There are lot of ways for doing this .. try in your own way ....

    Have a nice day Smile

    Monday, May 14, 2007 5:22 PM

All replies

  • Yes it is possible to write a program in c without using main.

    Here is the code:
    /* prog_without_main.c */

    int my_main(void)
    return 42;

    And use this command (% is command prompt) to compile:
    %gcc -O3 -nostartfiles prog_without_main.c

    Wednesday, May 16, 2007 9:17 AM