// This program demonstrates why we use pointers to help us // get around the whole only able to return one thing issue // with functions! // Week 5, Lecture 10 #include void swap(int *number_one, int *number_two); int main(void) { int number_one = 5; int number_two = 10; printf("Before swap:\n"); printf("Number 1 = %d\nNumber 2 = %d\n", number_one, number_two); // Call the function and pass the addresses of // the two numbers swap(&number_one, &number_two); printf("After swap:\n"); printf("Number 1 = %d\nNumber 2 = %d\n", number_one, number_two); return 0; } // Function that swaps two numbers // Input: two pointers // Output: void void swap(int *number_one, int *number_two) { int temp = *number_one; *number_one = *number_two; *number_two = temp; }