UVA problem 572 Oil deposit

I am solving this question :
I am using BFS and connected component, why I am getting sigsegv error, I don’t know, please check my code

Got Accepted :slight_smile: Problem was in resetting the value of mat and mark.

Cool … I could not figure that out either

//