C language to find the minimum path problem