Samsung Electronics Interview Question

Some problem regarding dynamic memory allocation.