answersLogoWhite

0


Best Answer

1. Because they are completely unrelated names.

2. Because there is no rule against them having the same names.

User Avatar

Wiki User

11y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Why is it possible to use the same variable names for actual and formal arguments in c language?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What are the formal arguments?

Formal arguments are the named arguments defined by the function. Actual arguments are those arguments that were passed to the function by the caller.


Which is the syntax used for passing a structure member as an argument to a function?

You can pass the address by using '&' with the pointer variable, while passing actual arguments. In formal arguments '*' is used in the place of '&'. To pass the address of a pointer variable a double pointer variable should be used .


Can anybody explain stack level functioning of recursion in c language exclusively?

Yes, any body can explain stack level functioning of recursion in C language exclusively. ;-) Whenever we invoke a function, the return address is pushed onto the call stack. That return address remains on the call stack until the function returns at which point the address is popped from the stack and control passed to that address. In this way, functions can always find their way back to their callers, even if those functions invoke other functions, including themselves (recursive functions). As well as the return address, the formal arguments of the function and the local variables of the function are also pushed onto the stack. Formal arguments are initialised by the actual arguments passed by the caller, assigning the values of the actual arguments to the formal arguments. If the formal argument is a pointer variable or reference, the address of the actual argument is passed instead. In addition, the call stack is used by the exception handling mechanism. When an exception is thrown by a function, the call stack "unwinds" (popping each function's stack frame) until a suitable handler is found.


What is the difference between actual and formal argument in c plus plus?

Formal parameters are the parameters as they are known in the function definition. Actual parameters (also known as arguments) are what are passed by the caller. For example, in the following code, a and b are the formal parameters, and x and y are the actual parameters:int max(int a, int b) {if (a > b) return a;else return b;}int m = max(x, y);


Can both actual and formal arguments can have the same name?

Yes, they can.


Why the actual arguments declared as float is accepted only as double in formal arguments in java?

Sorry I don't Think I could Solve It


What number when substituded for the variable in an equation makes the equation true?

you have to solve the actual equation in order to answer this about your variable


Sample program in c plus plus with parameter?

C++ doesn't have parameters it has arguments, both formal and actual. Actual arguments are the arguments you pass to a function. Formal arguments are the arguments used by the function and which are treated as local variables within the function body. Formal arguments always fall from scope when the function returns. In order for a function to make changes to the actual argument you you can either return the formal argument by value and assign the function to the actual argument upon return, or you can pass the argument by reference. In the former case, the returned value is temporary. If the function is not assigned to the actual argument, the temporary value falls from scope. In the latter case, the actual and formal arguments both refer to the same object through separate names (aliases). Thus any operations performed on the formal argument will affect the actual argument (they are one and the same object). Example: // Forward declarations. int byval (int); void byref (int&); int main() { int actual = 42; byval (actual); // The byval formal argument is no longer in scope. // Although a temporary value of 84 was returned, // it wasn't assigned to anything and is no longer // available. // The actual argument still has the value 42. actual = byval (actual); // The byval formal argument is no longer in scope, // however, its value was returned and assigned // to the actual argument. // The actual argument now has the value 84. byref (actual); // The formal argument and the actual argument are // one and the same argument. // The actual argument now has the value 42. } int byvalue(int formal) { formal *= 2; return formal; } // The formal argument no longer exists, but its value // was pushed into the function's return address. That // value will cease to exist unless the caller immediately // assigns the function's return value to a variable. void byref(int& formal) { formal /= 2; } // The formal argument no longer exists and nothing // was pushed onto the function's return address. // However, formal was just an alias for the actual // argument, thus the actual argument has already // been updated.


What are 3 types of Actual Motion?

Periodic, Variable, and Uniform motion.


Relationship between actual and formal arguments?

The formal arguments are the names given to the parameters/arguments in the function declaration. These names will be used within the body of the function. void myFunc( int i, char c ); // Function prototype The actual arguments are the variables and/or constants (those supplied by the caller) that are used when invoking the function. int intVar = 6; char charVar = 'e'; // Actual parameters 3 and 'G' will be mapped to the // formal parameters 'i' and 'c' myFunc( 3, 'G' ); // Execute function // Actual parameters 'intVar' and 'charVar' will be mapped // to the formal parameters 'i' and 'c' myFunc( intVar, charVar ); // Execute function


What is meant by arguments in c?

Arguments appear in functions and in function calls. Arguments passed to a function are known as actual arguments. The arguments used by the function are known as the formal arguments. In C, all arguments are passed by value, such that the formal argument is a copy of the actual argument.


What is the definition for ordered variable?

Ordered Variable is one where you can put the data into order, bt not give it an actual number. The height of a person compared to other's height is an ordered variable.