Answer Posted / sanish joseph
both malloc and new functions are used for dynamic memory
allocations and the basic difference is: malloc requires a
special "typecasting" when it allocates memory for eg. if
the pointer used is the char pointer then after the
processor allocates memory then this allocated memory needs
to be typecasted to char pointer i.e (char*).but new does
not requires any typecasting. Also, free is the keyword used
to free the memory while using malloc and delete the keyword
to free memory while using new, otherwise this will lead the
memory leak.
Is This Answer Correct ? | 13 Yes | 8 No |
Post New Answer View All Answers
What is the purpose of polymorphism?
write a programe to calculate the simple intrest and compund intrest using by function overlading
Give two or more real cenario of virtual function and vertual object
What is variable example?
What are the 4 pillars of oop?
What is the oops and benefits of oops programming?
What is multilevel inheritance?
What does enum stand for?
What is polymorphism explain its types?
Why do we use class?
Which language is not a true object oriented programming language?
how to get the oracle certification? send me the answer
What are the important components of cohesion?
What exactly is polymorphism?
Can you name some types of inheritance?