Skip to main content

Posts

Showing posts with the label Interview Questions

C++ Is It Safe to Delete a void Pointer?

According to C++ Standard deleting a void* (void pointer) is undefined behavior. However usually the program will compile and run without any errors. Also the memory pointed by the pointer will be cleared. But deleting a void pointer will not call destructors.

C++ Find Middle Element of a Linked List

This is a famous coding interview question that every programmer suppose to know. Here I am going to look at two different answers. First one is the obvious one, of course not the answer that the interviewer is looking for. Second one is the smart answer.