In this Program user asks to Swap a two number through function. User declares the pointer type variable for interchanging the value of two variables. User asks to enter the value. User make a function named swap that will be called in other class. Then a printing message for swapped value to the function then returns a value.
In other move the function swap is been called for interchanging the values to each other. In this criteria user declare a variable temp that will use to store a temporary time value for trespassing with each other variable like mentioned in the program temp=*d1 and then to other variable. In the last instance the result is been displayed on the screen.
This is Program that asks user to interchange the value with each other variable through function.
- Declaring required variables.
- Making function.
- Enters value.
- Call function.
- And display result on the screen.
Here is C source code for interchanging the value with each other through function Output of this program shown below.
void swap (double *d1, double *d2);
int main ()
double num1, num2;
printf("Type in 2 Numbers : ");
printf("\nThe two Numbers Swapped are %lf, %lf", num1, num2);
void swap (double *d1, double *d2)