#include <stdio.h>
#include <stdlib.h>
/*
 * Program to demonstrate use ptr vars, malloc, free.
 * Terry Harvey CISC 105 section 98 TA James Jamerson
 */

int main(){

    int x = 7; //automatic allocation, don't need to free
    int *iPtr = &x;
    int *p;

    *iPtr = 9;
    //p = iPtr;

    p = (int*)malloc(sizeof(int)); //dynamic allocation, must be free-d
    *p = 37;

    printf("%d\n", *iPtr);
    printf("%d\n", *p);

    free(p);

    return 0;
}
