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
What does a derived class inherit from a base class a) Only the Public members of the base class b) Only the Protected members of the base class c) Both the Public and the Protected members of the base class d) .c file
What is substring in c?
Is c programming hard?
What are the usage of pointer in c?
What does c mean in basketball?
A function can make the value of a variable available to another by a) declaring the variable as global variable b) Passing the variable as a parameter to the second function c) Either of the two methods in (A) and (B) d) binary stream
What does the function toupper() do?
Are pointers integers in c?
5 Write an Algorithm to find the maximum and minimum items in a set of ānā element.
which is conditional construct a) if statement b) switch statement c) while/for d) goto
How can I avoid the abort, retry, fail messages?
What is clrscr in c?
How can I find out if there are characters available for reading?
What is the difference between c and python?
What is 02d in c?