#include <stdio.h>
#include <stdlib.h>
/*
 * Program to write a function that can modify a variable from main();
 *
 * Study question: When three is added to data below, what is *really*
 * being added? Hint: not three.
 *
 * Terry Harvey CISC 105 section 98 TA James Jamerson
 */
int * g();
int main(){

    int *data;

    data = (int*)malloc(5 * sizeof(int));

    data[0] = 51; //what does this do?
    data[3] = 34;

    printf("address stored in data is %p\n", data);
    printf("value found at address stored in data is %d\n", *data);
    //do not program using pointer arithmetic, but this is what the square brackets do:
    printf("value found at address stored in data + 3 is %d\n", *(data + 3));
    printf("value found at address stored in data[3] is %d\n", data[3]);

    free(data);

    return 0;
}

