What will happen if I create an object using new and free it using free instead of delete?
it gives compile time error.
we can't predict
it leads to memory leaks.
it leads to memory leaks. Note: you have to make sure that if you use malloc, then use free only. And if you use new, then use delete only. Else it may lead to memory leaks.
Back To Top