Question: The following function should swap the values contained in two integer variables, nom 1 and num 2 . What, if anything, is wrong with this
The following function should swap the values contained in two integer variables, nom and num What, if anything, is wrong with this function?
void swap int num int num
int temp nam;
num num;
num temp;
You must first initialize temp to before using it
The variable temp should first be set to num not num
The swap function must use reference parameters.
The last line should be temp num
Nothing is wrong with this function.
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
