/* 11.14.06, Kambhamettu: This code creates 1D array by dynamic
memory allocation. Array size, thus is user input -- a huge change
from static arrays where you need to know the size at compile time. */

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

void main()
{
unsigned char *image;
int i,j;
FILE *fp;

fp=fopen("1dw","w");

printf("Print array size:");
scanf("%d",&i);

image = (unsigned char *) calloc (i, sizeof(unsigned char *)) ;

for (j=0;j<i;j++)
{
image[j] = 128;
fprintf(fp,"%d\n",image[j]);
}

free(image);

fclose(fp);

}
