C Program to demonstrate calloc dynamic memory allocation
Program
#include<stdio.h>
#include<stdlib.h>
int main()
{
int *p;
printf("Pointer before memory allocation is:\t%p\n", p);
p = (int *)calloc(sizeof(int), 1);
printf("Pointer after memory allocation is:\t%p\n", p);
}
Output
$ gcc calloc-dynamic-memory-allocation.c
$ ./a.out
Pointer before memory allocation is: (nil)
Pointer after memory allocation is: 0x5581b1b47670