Breadth first search in c