Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
stack during function call in C++ 2011
#1
Whenever we call a function, the compiler makes a stack that it uses to fulfill this function call. After the compiler puts the entries on the stack, the top (i.e. first entry in the stack) contains the return address of the function where the control will go back after executing the function. The next entries on the stack are the arguments of the function. The compiler pushes the last argument of the call list on the stack. Thus the last argument of the call list goes to the bottom of the stack. This is followed by the second last argument of the call list to be pushed on the stack. In this way, the first argument of the call list becomes the first element on the stack. Now in the end return address is pushed on the stack. So top of the stack will point to the return address.

0300-9520262
Get solution in 24 hour
|cpmputer & internetConfusedmileys81:[SIZE="4"][SIZE="3"]....[/SIZE][/SIZE]
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  why we use inline function if there are simple function available, or what is the spa Vuhelper 0 21,978 05-31-2012, 01:51 AM
Last Post: Vuhelper
  Default Function Argument with example Vuhelper 0 13,328 05-31-2012, 01:47 AM
Last Post: Vuhelper
  What is the difference among calloc function ,malloc function and recalloc function? Vuhelper 0 34,590 05-31-2012, 01:46 AM
Last Post: Vuhelper
  What is Function Overloading in C++ Vuhelper 0 5,399 05-31-2012, 01:45 AM
Last Post: Vuhelper
  offline function in C++ Vuhelper 0 3,624 05-31-2012, 01:42 AM
Last Post: Vuhelper
  i take input from getchar(); function in program in C++ 2012 Vuhelper 0 2,992 05-31-2012, 01:40 AM
Last Post: Vuhelper
  how we used the 1-calloc Function 2- malloc Function 3- free () 4- realloc Function i Vuhelper 1 31,140 05-31-2012, 01:35 AM
Last Post: Vuhelper
  What are the function of IO ports in C++ Vuhelper 0 3,599 05-31-2012, 01:27 AM
Last Post: Vuhelper
  how stack operation proves costly during traversing a tree Vuhelper 0 1,518 01-04-2012, 10:43 PM
Last Post: Vuhelper
  Argc(argument count) and argv(argument value) are used in main function Vuhelper 0 2,031 01-04-2012, 10:42 PM
Last Post: Vuhelper

Forum Jump:


Users browsing this thread: 1 Guest(s)