Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

what is mallloc()?how it works?

Answer Posted / vignesh1988i

malloc is briefly termed as Memory ALLOCation ......
whenever we write a program in C we will declare some
variables or arrays for a size more than whatever we need ,
etc etc..... so some variables are getting used correctly
and in arrays only some of the memory spaces are getting
used because the user dont know how much spaces he is gonna
use.......so here some memory is getting wasted without
using it.... so there comes a concept called DYNAMIC MEMORY
ALLOCATION in C...

we will give the values for how much memory we need at the
run time of the program... but this concept also only 85%
efficient... this has three types :
1)malloc();
2)calloc();
3)realloc();
malloc() is a function present in ALLOC.H standard library
which is used to allocate memory at run time (ie) in single
or in blocks.....

the syntax is :
pointer_variable=(typecasting
datatype*)malloc(sizeof(datatype));

this pointer variable should be of same datatype as the
typecasting datatype........

thank u

Is This Answer Correct ?    4 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Write an algorithm for implementing insertion and deletion operations in a singly linked list using arrays ?

3513


Why c language?

1068


Explain how can I make sure that my program is the only one accessing a file?

1222


What is a stream?

1135


What is the benefit of using #define to declare a constant?

1090


What is difference between structure and union in c programming?

1106


What is #include stdlib h?

1105


Explain what is the difference between a free-standing and a hosted environment?

1184


What is c language used for?

982


code for replace tabs with equivalent number of blanks

2162


What is c basic?

1173


what is the height of tree if leaf node is at level 3. please explain

2153


The statement, int(*x[]) () what does in indicate?

1149


How do you write a program which produces its own source code as output?

1121


What is getche() function?

1042