Code showing error, please find faults and help me in fixing them

Problem: Cycle detection in an undirected graph
https://practice.geeksforgeeks.org/problems/detect-cycle-in-an-undirected-graph/1#

error is because of wrong use of pointers

you can’t do *c (deference of pointer)
unless you provide the address of a variable to c

i have corrected the segmentation fault only
now you code run but output is still incorrect
first check the code at your own

Modified Code

can you point out in the code using a comment where have you made the change

check this

I tried solving this question again from the scratch and came up with this, could you check why doesn’t this work?

This is a new and a different solution

i have commented your mistakes

you don’t have to use parent array if you are using parent variable

Modified code

Thank You so much. Btw, I was wondering why did it take more than 2 days for getting a reply on this problem? Is there some technical issue going on?

No technical error
actually i missed your doubt

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.