Help in spiral print

my code is working fine but none of the test cases are working.
here is the code:

If none of the test cases are passing, then how can you say your code is working fine?
change your initializations to:-
int sr=0;

int sc=0;

int ec=m-1;

int er=n-1;

coz its working for the sample input btw still there is some error

What is your updated code now? share the link