0
what does this line do? especially the comma part
ihi = y[0] > y[1] ? (inhi = 1, 0) : (inhi = 0, 1)
7 ответов
+ 2
i understood it. here is what is happening:
basically, the syntax is
a = (b = 1, 2);
what this does is, first, it does whatever is in the parentheses, which is, first assign 1 to b then do another command which is to return 2. after that, the 2 goes to the variable a.
so now, a = 2 and b = 1.
you could do any expression separated by commas, like:
a = (b = 0, b += 2, c = 3, 1);
now a = 1, b = 2, c = 3.
+ 1
it was in a post of obfuscated c++ code but i want to know this so bad.
0
What is inhi here?
0
an int or a bool, i suppose, because you are assigning 0 or 1 to it. but i dont know what does the "," separate. where does the remaining 1 or 0 go?
0
OK, hum may be it means a decimal number? Like 0.1 or 1.0?
0
Or may be it's a kind of struct which is composed of two values, like inhi(a, b)
0
there is a , not a . that means it is not decimal. a struct cannot be because the brackets must be { }.
thanks for the response though.