#include <stdlib.h>
#include <stdio.h>

//static dizinin boyutunu vs.. genisleteyemeyiz. Ancak dynamic diziler genisletilebilirdir.

int main()
{

    int *x;
    int n;

    //Create a 1000 element table, sizeof() returns the compiler.

    x=malloc(1000*sizeof(int));

    if(x==NULL) {
        printf("\nUnable to allocate a 1000 element integer table");
        exit(0);
    }

    //assign values to each table element.
    for(n=0;n<1000;n++) {
        *x=n;
        x++;
    }

    //Return x to the start of the table.
    x-=1000;

    //Display the values in the table.
    for(n=0;n<1000;n++) {
        printf("\nElement %d holds a value of %d",n,*x);
        x++;
    }

    //Deallocate
    free(x);


    return 0;
}
