Imagine Communications interview question

Some pointer related problem solving