Question: Q 1 Write a program that does the following: i ) Uses scanf to read 2 numbers and assign these to two variables (
Q Write a program that does the following:
i Uses scanf to read numbers and assign these to two variables mathrmxmathrmx in main function
ii Print the contents of these two variables
iii Defines a function void swapCallByValueint parameter int parameter This function swaps the values of parameters provided
iv Calls the function swapCallByValue in main function
v Prints the values of x and x 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 and x in main
viii Prints the output as shown below.
Originally:
x and x
After swapCallByValue:
x and x
Originally:
x and x
After swapCallByReference:
x and x
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
