RANJITH KUMAR KASUKURTHI wrote: > I know that __builtin_return_address() function returns the > return address of the current function when zero is passed > as an argument. > > 1) In which header file __builtin_return_address() function is defined? None. It's a compiler builtin. > 2) Return address is stored on stack when a function is called. I think > __builtin_return_address() > is reading that value on stack and returning. Am I right? It depends on the target; some targets pass return address in a register. > If so > 3) The location where that return address is stored on stack may vary > depending upon number of arguments passed to the function, or number of > local variables inside the function, or whether the function is returning > a value or not........ Not usually, no. On those machines that pass the return address on the stack, that address is on the top. > How __builtin_return_address() function knows where exactly the return > address is stored on stack???? The compiler knows where everything is: the return address is nothing special. Andrew.