both malloc amp new functions are utilized for


Both malloc & new functions are utilized for dynamic memory allocations & the basic difference is: malloc need a special "typecasting" while it allocates memory for eg. if the pointer utilized is the char pointer then after processor allocates memory then it allocated memory required to be typecasted to char pointer for example (char*).however new does not needs any typecasting. Also, free is the keyword utilized to free the memory whereas using malloc & delete the keyword to free memory whereas using new, or else it will lead the memory leak.

 

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: both malloc amp new functions are utilized for
Reference No:- TGS0211622

Expected delivery within 24 Hours