#include <stdio.h>
#include <stdlib.h>
/*
 * Program to write a function that can modify a variable from main();
 * Terry Harvey CISC 105 section 98 TA James Jamerson
 */
void f(int* p);
int main(){

    int *iPtr;
    int i = 53;
    int j = 67;
    iPtr = &i;
    *iPtr = 65;

    printf("address stored in iPtr is %p\n", iPtr);
    printf("value found at address stored in iPtr is %d\n", *iPtr);

    f(iPtr); //function call that can change i
    f(&j); //function call that can change j

    printf("address stored in iPtr is %p\n", iPtr);
    printf("value found at address stored in iPtr is %d\n", *iPtr);
    printf("j is %d\n", j);
    //free(iPtr);

    return 0;
}

void f(int* p){//f can change the value of a variable in main()
    (*p)++;
    return;
}
