In this program user ask to swap the numbers. User declares the variables for containing the value in it. User define the method with arguments or parameter (*int, int*). Then user assign the value to each variables then print the message to before and after value phase in each variable. Next move to call the function that declares the early in the program. Using swapping method as usual. Display the result on the screen as output.
This is C program that asks user to swap two numbers.
- Declare the variables.
- Using method.
- Display the result on the screen.
Here is C source code to swap the two numbers. The output of this program shown below.
int swaping(int *,int *);
printf ( "Before swaping a = %d & b = %d",a,b);
printf("\nAfter swaping a = %d & b = %d",a,b);
int swaping(int * a, int * b)