Fixed code to compile with g++ and added the first test case that supposedly segfaults and the correct output and the actual output i got from running it on my machine