
October 17th, 2012, 08:36 AM
|
|
Registered User
|
|
Join Date: Oct 2012
Posts: 2
Time spent in forums: 27 m 28 sec
Reputation Power: 0
|
|
|
Help (Dynamic memory allocation)
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 ..
#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 malloc line..
Thank you ..
Plz give me good website for c tutorial 
|