#include <iostream>
using namespace std;

void passPointer(int *x);

int main()
{
    int value = 10;
    int* vPtr = &value;

    std::cout << "value before function call: " << value << '\n';
    std::cout << "Address contained by vPtr before function call: " << vPtr << '\n';

    passPointer(vPtr);

    std::cout << "value after function call: " << value << '\n';
    std::cout << "Address contained by vPtr after function call: " << vPtr << '\n';
}

void passPointer(int *x){
    int local_variable;

    std::cout << "Address of local_variable: " << &local_variable << '\n';

    *x = 20;                    // derefence allows one to get a reference to the object pointed to.
    x = &local_variable;        // not dereferencing means we're modifying a copy of the pointer.
}