swap function
1. The method: To swap two values "value1" and "value2", we need to create the third temporary one "tempo" , to put within the first one while changing the two variables, as follows: tempo = value1 ; value1 = value2 ; value2 = tempo ; 2. Example: #include <stdio.h> int main() { int value1, value2, tempo ; /* Scaning the two values */ printf("Enter two integers\n"); scanf ("%d%d", &value1, &value2); /* Displaying the two values*/ printf("Before swapping, value1 = %d, value2 = %d\n", value1, value2); /* Swapping the two values */ tempo = value1 ; value1 = value2 ; value2 = tempo ; /* Displaying the swapped values*/ printf("After swapping, value1 = %d, value2 = %d\n", value1, value2); return 0; }