answersLogoWhite

0

The calling code pushes the return address onto the call stack. When the function returns, it pops the return address off the call stack and returns control to that address. The call stack (or simply the stack), is also used to pass parameters to functions and to receive return values from functions, as well as for local storage, evaluation, and the this pointer when calling class member functions. Functions that call other functions, or that recursively call themselves, will increase consumption of the call stack accordingly. This is known as winding, because the return addresses will remain on the stack until the function is ready to return (even if the function calls itself or another function), thus allowing functions to automatically unwind. In other words, it's a bit like leaving a trail of breadcrumbs (as per the Hansel & Gretel fairytale) allowing functions to retrace their steps back to the original call site and, ultimately, back to the main function.

User Avatar

Wiki User

12y ago

What else can I help you with?

Related Questions

What is a visual basic function?

A function is a segment of code which you pass a value to and get a value back from, the function acts upon (or not) that value passed to it and returns a value to the calling method; this makes it slightly different from a Sub, which returns no value to its calling method.


What statement causes a function to end and sends a value back to the part of the program that called the function?

The statement that causes a function to end and sends a value back to the calling part of the program is the return statement. When a return statement is executed, it terminates the function and can optionally pass a value back to the caller. If no value is specified, the function returns None in Python or equivalent in other languages. This allows the caller to receive the result of the function's computation.


How will you pass arguments to a function in c plus plus?

If you have this function: int add(int x, int y) { return x + y; } you would pass the arguments when calling the function in the () like this: add(4, 7); 4 & 7 would be the arguments.


What is the function of the air control sensor of a 1991s10?

The function of the air control sensor of a 1991 S10 is to determine the amount of air that the idle air valve allows to pass through it.


What are the different types of function in c plus plus programming?

There are five types of functions and they are:Functions with no arguments and no return values.Functions with arguments and no return values.Functions with arguments and return values.Functions that return multiple values.Functions with no arguments and return values.Functions with no arguments and no return value.A C function without any arguments means you cannot pass data (values like int, char etc) to the called function. Similarly, function with no return type does not pass back data to the calling function. It is one of the simplest types of function in C. This type of function which does not return any value cannot be used in an expression it can be used only as independent statement.Functions with arguments and no return value.A C function with arguments can perform much better than previous function type. This type of function can accept data from calling function. In other words, you send data to the called function from calling function but you cannot send result data back to the calling function. Rather, it displays the result on the terminal. But we can control the output of function by providing various values as arguments. Functions with arguments and return value.This type of function can send arguments (data) from the calling function to the called function and wait for the result to be returned back from the called function back to the calling function. And this type of function is mostly used in programming world because it can do two way communications; it can accept data as arguments as well as can send back data as return value. The data returned by the function can be used later in our program for further calculations. Functions with no arguments but returns value.We may need a function which does not take any argument but only returns values to the calling function then this type of function is useful. The best example of this type of function is "getchar()" library function which is declared in the header file "stdio.h". We can declare a similar library function of own. Functions that return multiple values.So far, we have learned and seen that in a function, return statement was able to return only single value. That is because; a return statement can return only one value. But if we want to send back more than one value then how we could do this? We have used arguments to send values to the called function, in the same way we can also use arguments to send back information to the calling function. The arguments that are used to send back data are called Output Parameters.It is a bit difficult for novice because this type of function uses pointer


What is the function of mylar capacitor?

In electronic circuits a capacitor is used to pass AC and block DC.


What was the effect of the action of glorieta pass on the confederacy's attempt to control the American southwest?

The Confederacy lost at Glorieta Pass and had to walk back to Texas.


What is calling by reference how it is different from call by value in c program?

Calling a function by value means the variable will be copied. That means that, any changes you make to the variable will be applied to the copy, and not the real one. If you pass by reference, the actual intended variable is modified.


What is the function os a air control sensor of a 4.3 1991 s10?

The function of an air control sensor of a 4.3 1991 S10 is to determine the amount of air that the idle air valve allows to pass trough it and bypasses the throttle plate.


Can you pass addresses to a function in C plus plus?

If the identifier you want to pass is an ordinary identifier, pass it as the address of... function(&identifier); If the identifier you want to pass is an array identifier, pass its name... function(arrayname);


What is calling by reference?

In C++ (C Plus Plus), when you call by reference, you are directly accessing the data of the referenced object. When you pass an object to a function by reference, any and all alterations to the object made within the function carry through to the actual object.


What was the effect of the action at Glorieta Pass on the Confederacy's attempt to control the American Southwest?

The Confederacy lost at Glorieta Pass and had to walk back to Texas. * The confederates retreated to Texas and never again threatened union control of the Southwest