i am beginner in programming. I want to understand dynemic memory allocation function. i search it google but i dont satisified with it... Can anybody plz explain me dynamic memory allocation function.. malloc(),realloc(),calloc() and freee()..
In school mam do this example ..
Code:
#include<stdio.h>
#include<conio.h>
#include<alloc.h>
#define NULL 0
void main()
{
int *t,*p,size;
clrscr();
printf("Enter size");
scanf("%d",&size);
t=(int *)malloc(size * sizeof(int));
if(t==NULL)
{
printf("No space available");
}
for(p=t;p<=t+size;p++)
{
scanf("%d",p);
}
printf("Display table value");
for(p=t+size-1;p>=t;p--)
{
printf("%d values at %u address",*p,p);
}
getch();
}
Plzz explain me this example ..
Thank you