write a program to de-allocate the memory then free the allocated memory.
#include<stdio.h> #include<conio.h> #include<stdlib.h> int main() { int n,i; int *ptr; printf("enter the no. of elements:"); scanf("%d",&n); ptr=(int*)malloc(n*sizeof(int)); printf("memory allocated using malloc\n"); for(i=0;i<n;i++) { ptr[i]=i+1; } free(ptr); printf("\nmemory freed"); return 0; }