Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

New, delete, malloc, free

Tags:

c++

new and delete are said to be preprocessors while malloc and free are functions. What is meant by new and delete being preprocessors?

like image 905
ckv Avatar asked Apr 12 '26 09:04

ckv


1 Answers

new and delete are C++ operators (like +, (), etc.) whereas malloc and free are (C) functions. Some operators (including new and delete) can be overloaded.

like image 154
Rhangaun Avatar answered Apr 15 '26 00:04

Rhangaun