#include<stdio.h>
#include<string.h>
#include<stdlib.h>
main()
{
char
*mem_allocation;
clrscr();
mem_allocation=
malloc( 20* sizeof(char));
if(mem_allocation==NULL)
{
printf("couldn't
able to allocate requested memory\n");
}
else
{
strcpy(mem_allocation,"Besties");
}
printf("Dynamically
allocated memory content:""%s",mem_allocation);
free(mem_allocation);
}
No comments:
Post a Comment