19 lines
329 B
C
19 lines
329 B
C
|
#include <stdio.h>
|
||
|
#include <stdlib.h>
|
||
|
|
||
|
int main(void)
|
||
|
{
|
||
|
// Declare an integer array and an integer pointer
|
||
|
int *pData;
|
||
|
int datlen;
|
||
|
|
||
|
printf("Length of data to be allocated: ");
|
||
|
scanf("%d", &datlen);
|
||
|
|
||
|
// Using malloc
|
||
|
pData = malloc ( datlen * sizeof (int));
|
||
|
|
||
|
free(pData);
|
||
|
return 0; // Exit
|
||
|
}
|