1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Can u dare to answer this

Discussion in 'C' started by Anchal Laller, Feb 3, 2011.

  1. Anchal Laller

    Anchal Laller New Member

    Joined:
    Feb 3, 2011
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    As we know execution starts from main method, is there any procedure to replace this calling by other function
    In which file this information is defined??
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,285
    Likes Received:
    364
    Trophy Points:
    83
    Yes you can define your own static variable which calls a function and this way your execution can begin before call to main.
     
  3. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,012
    Likes Received:
    203
    Trophy Points:
    0
    Occupation:
    Senior Support Engineer
    Location:
    England
    The call to main is performed in a compiler-specific object file, in at least one compiler I've seen this is called _crt0.o. If you write your own _crt0.c and compile it, you could in theory change the starting function, but there's not a lot of point: just create a main function that calls the function you want to call; it's a lot less work.
     

Share This Page