I figured out dyd[z]==dyd[q] needs to be dyd[z]=dyd[q] as with those 2 conditions code works normally, but the problem remains with rank[z]==rank[q]+1 || rank[z]+1==rank[q], it just doesn't want to do what I want and if I try to delete one equal sign, it gives me
lvalue required as left operand of assignment
So the question emerges, what's the actual difference between dyd[z] = / == dyd[q] ? I thought == means "is equal to" while = is supposed to mean simply "is" when declaring values, isn't it?... and how the heck do i tell it to simply check if one array is equal to other array+1?
put a breakpoint on line 30 and tell us what your value for n is?
The code as posted in the original post works fine for me with the dataset you posted.
I figured out dyd[z]==dyd[q] needs to be dyd[z]=dyd[q] as with those 2 conditions code works normally
Doubtful. Setting dyd[z] to the value held by dyd[q] means that portion of the condition will always be true except when dyd[q] happens to be 0 (which in this case would be never.) You would also be changing the same element multiple times in the loop, which doesn't seem very useful.