Whyy isn't code working

i have submitted the code but why isnt it working ?? help me with errors please

int parent[v] = {-1};
int rank[v] = {1};

this will not update all element of array to -1 but only change the first element to -1

can you check now?? i have used a loop to change the initialization

plz share the code
i can see your code only if you have submitted the problem

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.