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
Tell me about low level programming languages.
How variables are declared in c?
plz let me know how to become a telecom protocol tester. thank you.
How do you search data in a data file using random access method?
Which is better pointer or array?
Why is c called a mid-level programming language?
What is main return c?
Explain heap and queue.
what does static variable mean?
Why is sprintf unsafe?
Is printf a keyword?
What does typeof return in c?
What are the Advantages of using macro
What is getche() function?
What is array of pointers to string?