x

Choose Country Code

x

Direction

x

Ask a Question

  • Ask a Question
  • Scan a Question
  • Post MCQ
  • Note: File extension must be of jpg, jpeg, png, bmp format and file size must not exceed 5 MB
x

Ask a Question

x

x
x
x
Hire a Tutor

Answers and Solutions

What's Your Question?
Answer

Hi Nisha,

  • Actually both are used to allocate memory. To understand the differences find the sytaxes for both and read the following. we can also say these are the advantages of 'new' over 'malloc'.
  • New automatically computes the size of the var/obj. i.e., no need to use 'sizeof' operator.
  • New automatically returns the correct pointer-type. So there is no nee to use a type-cast operator.
  • Using New, we can initialize the obj/var while creating the memory space.

 

Post Answer and Earn Credit Points

Get 5 credit points for each correct answer. The best one gets 25 in all.

Post Answer