This commit is contained in:
2023-10-06 16:59:12 +01:00
parent 7bb7fc04b1
commit 8b1303304d
2 changed files with 41 additions and 0 deletions

18
C16/ex2.c Normal file
View File

@@ -0,0 +1,18 @@
#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
}