Question: Q 1 Write a program that does the following: i ) Uses scanf to read 2 numbers and assign these to two variables (

Q1 Write a program that does the following:
i) Uses scanf to read 2 numbers and assign these to two variables \(\mathrm{x}1,\mathrm{x}2\) in main function
ii) Print the contents of these two variables
iii) Defines a function void swapCallByValue(int parameter1, int parameter2). This function swaps the values of parameters provided
iv) Calls the function swapCallByValue(...) in main function
v) Prints the values of \( x 1\) and \( x 2\) in main
vi) Defines a function void swapCallByRefernce (...,.....). This function swaps the values pointed to by the parameters provided (pass by reference)
vii) Prints the values of \( x 1\) and \( x 2\) in main
viii) Prints the output as shown below.
```
Originally:
x1=5 and x2=10.
After swapCallByValue:
x1=5 and x2=10.
Originally:
x1=5 and x2=10.
After swapCallByReference:
x1=10 and x2=5.
```
Q 1 Write a program that does the following: i )

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 Programming Questions!