// --------------------------------------------

// File: exercise2.cpp
// Intermediate exercise: Using pointers

#include <iostream>
using namespace std;

// Function to swap two numbers using pointers
void swap(int* a, int* b) {
    int temp = *a;
    *a = *b;
    *b = temp;
}

int main() {
    // Define two integer variables
    int x = 5, y = 10;
    
    // Print original values
    cout << "Before swap: x = " << x << ", y = " << y << endl;
    
    // Call swap function
    swap(&x, &y);
    
    // Print swapped values
    cout << "After swap: x = " << x << ", y = " << y << endl;
    
    return 0;
}

