Question: In the program in Question 1 parameter passing method Pass by Value is used. a) Write the same program using parameter passing method Pass by

In the program in Question 1 parameter passing method Pass by Value is used.

a) Write the same program using parameter passing method Pass by Reference so that the new program will displays the same results as in the program in Question 1. (30 points)

b) In the new program explain why the value of x is changed after calling the function? (20 points)

#include

int Func1(int y){

printf("The value of y-2 in the Func1 is %d ", y-2);

return(y-2);

}

int main(void)

{

int x = 12;

printf("Before calling the function the value of x is %d ", x);

x=Func1(x);

printf("After calling the function the value of x is %d ", x);

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!