answersLogoWhite

0

When we call a function, memory needed for all formal arguments and scratch variables (variables that are declared inside the function) are allocated from the stack area of the program and the same will be de-allocated when control comes out of the function. This is called as stack frame or activation frame.

When we send an argument as passing by value style, its value is assigned to formal argument. However, whatever operations takes place on formal argument does not reflect on the actual argument because those changes are taking place in some other memory not in the same memory of the actual argument,

void swap(int a, int b)

{

int t=a;

a=b;

b=a;

}

int main()

{

int x=10, y=17;

swap(x,y);

printf("%d %d\n", x, y);/* values will not change */

return 0;

}

User Avatar

Wiki User

13y ago

What else can I help you with?

Related Questions

Call by function in c language?

I guess you meant the following:'In C language, when you call a function,the parameters are passed by-value.'


What is meant by a function call?

A function call is where you "call" a function and execute its body. For example: void example() { } int main() { example(); // call the function "example" and execute its bodyreturn 0; }


Can you call predefined function recursively?

Guess you meant: can a recursive function call predefined functions? Answer: sure, why not.


What is the difference between call by name and call by value in programming languages?

In programming languages, call by value passes the value of a variable to a function, while call by name passes the name of the variable. Call by value evaluates the value before passing it, while call by name evaluates the value when it is used in the function.


What is the difference between call by value and call by name in programming languages?

In call by value, the value of the argument is passed to the function, while in call by name, the expression for the argument is passed and evaluated each time it is used in the function.


When function returns a value the entire function call can be assigned a variable?

AnswerYes, it can. For instance, if your function returns double you can assign the function call to a variable of type double.AnswerNo, only the returned value, of course.


What is meant by the term Value consensus?

evaluate the concepts of value consensus and false consciousness in relation to the function of education.


What is Call by value?

when the function is call by value,u are making any changes in formal parameter does not reflect the actuasl parameter.


What is meant by void abcint?

void abc(int); is a function declaration. The declared function has no return value, is named abc and accepts one integer argument by value.


When only a copy of the argument's value is passed into the paremeter variable?

By default, a copy of the argument's value is passed into the parameter variable. This is "call by value" semantics, and the called function can do whatever it wants with the parameter, but it cannot alter the original copy. Sometimes, in C and C++, you can pass the address of the value instead. This is "call by address" semantics, but the called function must be designed to handle it - in this case, the called function can alter the original value. (Actually, it is always "call by value" - what we call "call by address" is simply passing the value of the address, a subtle distinction which is important to understanding the language.)


If function does not return value by default it returns python?

If a function in Python does not explicitly return a value using the return statement, it implicitly returns None by default. This means that when you call such a function, the result will be None, indicating that no value was returned. You can check this by assigning the function call to a variable and printing it, which will show None as the output.


How many values you can return by call by value and call by reference at a time?

A function can only return one value, but it can modify its parameters if their type is 'in out' or 'out'.