#FUNCTION CALL IN #C | CALL BY VALUE | CALL BY REFERENCE | CALL BY #ADDRESS
Methods for #Parameter #Passing to #Function #Call in C Parameter passing is basically to have communication between called function and calling function. There are two methods of parameter passing namely, Call by #value and Call by #reference. 1. Call by Value: In call by #value, during the #function call, the #actual #parameter value is copied and passed to the formal parameter. #Changes made to the formal #parameters do not affect the #actual parameters. When a single value is passed to a function via an actual #argument, the value of the actual argument is copied into the function. Therefore, the value of the corresponding formal argument can be altered within the function, but the value of the actual argument within the calling function will not change. This procedure for passing the value of a parameter to a function is known as passing by value. Thus in a call by value, a copy of actual arguments is passed to formal arguments of the called function and any change made to the formal arguments in the called function have no effect on the values of actual arguments in the calling function. A value of the actual parameter cannot be modified by the formal parameter. Different Memory is allocated for both actual and formal parameters. 2. Call by #Reference: In call by #reference, the #address of actual #arguments is #passed to #formal #arguments of the called function. This means any changes made in formal parameters in called function is reflected into actual parameters of calling function. Thus, the value of the actual parameter can be modified by the formal parameter. Same memory is used for both actual and formal parameters since the only address is used by both parameters. It uses pointers to pass the reference of an actual parameter to #formal #parameter.
Download
0 formatsNo download links available.