#include <stdio.h>
#include <stdlib.h>
int main ()
{
int i, n;
int *pointerData;
printf ("Enter number of items to be stored: ");
scanf ("%d", &i);
pointerData = (int*) calloc (i, sizeof(int));
if (pointerData==NULL)
exit (1);
for (n = 0; n < i; n++)
{
printf ("Enter number #%d: ", n);
scanf ("%d", &pointerData[ n ]);
}
printf ("You have entered: ");
for (n = 0; n < i; n++)
printf ("%d ", pointerData[ n ]);
free (pointerData);
return 0;
}
|