#include <iostream>

using namespace std;

/*
 * Program to demonstrate the difference between passing a variable's
 * value and the value of its address.
 */

const int DATA_SIZE = 10;


int cantChangeInt(int input);
void willChangeInt(int * intPtr);

int main(){

    int data[DATA_SIZE] = {2,6,2,1,5,7,8};
    int spam = 3;

    cout << &spam << endl;

    cantChangeInt(spam);

    cout << "spam is " << spam << endl;

    willChangeInt(&spam); //passes the address of the var spam

    cout << "spam is " << spam << endl; //should print new val for spam

    return 0;
}

int cantChangeInt(int input){
    input = 2;
    return 17;
}

void willChangeInt(int * intPtr){

    *intPtr = 2;
    return;
}//void willChangeInt(int * intPtr){

