Describing what was the real problem was really helpful, because it helps someone debugging to narrow down the code issue.
I'd like to experiment, if you don't mind and write my answer from my point of view, not from the point of your solution.
It looked rather okay and was properly formatted. I found the labirynth description to be extremely unreadable, so I simply broke it up in lines:
char maze[110] =
"|.|________\n"