1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice


Discussion in 'C' started by Rajesh M. Kanojia, Dec 12, 2012.

  1. Rajesh M. Kanojia

    Rajesh M. Kanojia New Member

    dear members
    can any one tell me where exactly function get loaded at run time in c program.
    suppose i call 2 function in main().
    1- abc();
    2- xyz();
    my question is that is abc() and xyz() occupy memory if yes then where
  2. xpi0t0s

    xpi0t0s Mentor

    Why do you want to know?

    They are loaded with main in the TEXT part of the executable. You will need to learn assembly language programming to know what that really means. Hence the above question. If you want to know the addresses of the functions, that's simple, just define a function pointer to point to those functions, then pass the pointer into printf and use the format mask %08lx to display the address.
  3. iranjit

    iranjit New Member

    I am sorry but, it is hard to understand your question.

    Overloaded functions have same name but, different arguments(either different number of arguments or different types of argument). Remember, if two functions have same name and argument/s but different return type then, don't assume these two functions are overloaded functions. Instead compiler gets confused and displays error.

    If there are two overloaded functions then, compiler doesn't know which function to call until run-time and executes the appropriate function in accordance with the argument passed.
  4. xpi0t0s

    xpi0t0s Mentor

    "Why do you want to know" is not a difficult question to understand. But I can't answer your original question until I know, er, why you want to know.

    Your original question has nothing to do with overloaded functions because abc() and xyz() differ in name. But with overloaded functions they differ in parameters so the compiler can tell which function to call by looking at the parameters. So if you have abc() and abc(int), then the compiler can determine which to call by whether or not you pass an int, and if you try to default the int param (e.g. void abc(int x=0)) then the compiler will throw an error because it won't be able to determine if a call like abc(); means call abc() or abc(0).

    By the way, the term "run time" has nothing to do with the compiler. The compiler compiles the code to object code. The linker links the object code with the relevant libraries to make executable. When you run the program, that is "run-time" and the compiler is not involved.
    shabbir likes this.
  5. JonSon

    JonSon New Member

    An action performed by a device department or person that produces a result.The return value of the first non-failed function without executing successive functions .

Share This Page