Flood fill algorithm in c