function calls and return address

This is a discussion on function calls and return address within the C Programming forums, part of the General Programming Boards category; Suppose function f calls function g, which in turn calls other functions. How does function g know where it should ...

  1. #1
    Registered User
    Join Date
    Apr 2012
    Posts
    21

    function calls and return address

    Suppose function f calls function g, which in turn calls other functions. How does function g know where it should return to when its task is done?

    I know a stack space is created at every function call, but how control is returned to the program after a function call is still a mystery to me. if anyone could briefly explain this process thanks.

  2. #2
    Registered User manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    Kolkata@India
    Posts
    2,528
    Manasij Mukherjee | gcc-4.9.2 @Arch Linux
    Slow and Steady wins the race... if and only if :
    1.None of the other participants are fast and steady.
    2.The fast and unsteady suddenly falls asleep while running !



  3. #3
    Registered User
    Join Date
    Apr 2012
    Posts
    21
    thanks for that. i visited Stack (abstract data type) before but this page is much better.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Returning Address with Return Statement?
    By Waleed Mujeeb in forum C++ Programming
    Replies: 5
    Last Post: 03-23-2012, 06:47 AM
  2. how to return address of a pointer?
    By spotty in forum C Programming
    Replies: 1
    Last Post: 02-11-2010, 08:11 PM
  3. modifying a return address of a function
    By jay1313 in forum C Programming
    Replies: 3
    Last Post: 09-18-2008, 10:09 AM
  4. how to return the address of a member of a class
    By *DEAD* in forum C++ Programming
    Replies: 6
    Last Post: 07-13-2007, 10:15 AM
  5. Replies: 2
    Last Post: 12-07-2004, 02:31 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21