Giving segmentation Fault

why while loop is giving segmentation fault, can you please find the mistake in this

Hello @coolio.boy385,

There are many reasons for segmentation error:
You can read about it from this link.

In your code, the reason is: you are not handling the pointers properly.

I have modified your code:

Hope, this would help.
Give a like if you are satisfied.

1 Like

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.