Exforsys
Results 1 to 4 of 4

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 Programming Talk forums, part of the Archive category; Hi How can we run a " C Langauge program without writing the main function It is possible to do ...

  1. #1
    Dharmesh rathod is offline Junior Member Array
    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?

  2. #2
    shrikant telkar is offline Junior Member Array
    Join Date
    Mar 2007
    Answers
    4

    shri code

    Quote Originally Posted by Dharmesh rathod View Post
    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?
    thank you. ..........................................................

  3. #3
    Skunk is offline Junior Member Array
    Join Date
    Jul 2008
    Answers
    1
    Quote Originally Posted by easysameer View Post
    Code:
    #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.

  4. #4
    pratap kumar is offline Junior Member Array
    Join Date
    Aug 2008
    Answers
    2

    ans

    Quote Originally Posted by Dharmesh rathod View Post
    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?

    a program must have a main function (compulsory) without main it is impossible

    •