This code is not giving the spiral output

the code is not giving spiral output, please tell me the mistake.

hello @shazanahmed1
u have initialised endrow and endcol with -1 .

I have fixed that but now the program is giving segmentation error and if I’m running the program on my machine it’s not stopping and giving random numbers

check now->

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.