#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
 */
int * g();
int main(){

    int *iPtr;

    iPtr = g(); //g can allocate space for use in main
    iPtr = 5;
    printf("address stored in iPtr is %p\n", iPtr);
    printf("value found at address stored in iPtr is %d\n", *iPtr);

    //free(iPtr);

    return 0;
}

//g will allocate new space for an int
int * g(){
    return (int*)malloc(sizeof(int));
}
