Code completed. Getting segFault in case of 3*3