pointer_variable=(typecasting
datatype*)malloc(sizeof(datatype));
This is the syntax for malloc?Please explain this,how it
work with an example?
Answer Posted / pramod
I'll add few more lines to answer above just to make it a
bit more understandable.
Malloc allocates consequetive blocks of memory of requested
size.Then it returns the starting address of this block ,
the address returned is of type void , since it is a void
pointer so we need to typecast it to one that we requested
so typecasting is done( This headache has been removed in
C++ by using new as new automatically does this typecasting)
Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
How do you construct an increment statement or decrement statement in C?
What is the method to save data in stack data structure type?
What is string function in c?
Explain how do you search data in a data file using random access method?
What is the difference between struct and typedef struct in c?
How will you print TATA alone from TATA POWER using string copy and concate commands in C?
explain what is a newline escape sequence?
what is recursion in C
how to write optimum code to divide a 50 digit number with a 25 digit number??
Explain what is the advantage of a random access file?
What is the use of header files?
What are the advantages of the functions?
which is an algorithm for sorting in a growing Lexicographic order
What are the different types of errors?
Is it possible to execute code even after the program exits the main() function?