代替
cardNumber = j+1;
deck[i][j] = cardNumber;
theDeck[k] = cardNumber;
只是说有效吗
deck[i][j] = theDeck[k] = cardNumber;
将cardNumber同时分配给deck和theDeck?
是的。赋值运算符返回一个值。
是的,它是一个表达式,它的值是赋值的右侧。请注意,这也来自=
(right-to-left) 的关联性,这使得:
x = y = z
相当于:
x = (y = z)
但不是:
(x = y) = z /* wouldn't work */
所以你可以走得更远,写:
theDeck[k] = deck[i][j] = cardNumber = j+1;
是的; 是这样的:
deck[i][j] = (theDeck[k] = cardNumber);