Answer:
#include <stdio.h>
void SwapValues(int* userVal1, int* userVal2)
{
int temp = *userVal1;
*userVal1 = *userVal2;
*userVal2 = temp;
}
int main(void)
{
int a = 3;
int b = 8;
printf("Before swap: a=%d, b=%d\\", a, b);
SwapValues(&a, &b);
printf("After swap: a=%d, b=%d\\", a, b);
return 0;
}
Step-by-step explanation:
For swapping variables efficiently, you need a helper variable in C or C++.