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
Write an algorithm for implementing insertion and deletion operations in a singly linked list using arrays ?
Why c language?
Explain how can I make sure that my program is the only one accessing a file?
What is a stream?
What is the benefit of using #define to declare a constant?
What is difference between structure and union in c programming?
What is #include stdlib h?
Explain what is the difference between a free-standing and a hosted environment?
What is c language used for?
code for replace tabs with equivalent number of blanks
What is c basic?
what is the height of tree if leaf node is at level 3. please explain
The statement, int(*x[]) () what does in indicate?
How do you write a program which produces its own source code as output?
What is getche() function?