我在声明了一个指针数组并且把它传入方法时
Node* hands[4];
Deal(deck,hands,4,"one-at-a-time",13);
在传入以前debugger显示hands的值为
hands[0] = 0x746365667265700e
hands[1] = NULL
hands[2] = NULL
hands[3] = 0x00007fc44b402430
当传入方法
void Deal(Node* &deck, Node* hands[], int handsSize, std::string type, int eachSize){
for (int i = 0; i < handsSize; ++i) {
hands[i] = nullptr;
}
Node* temp = deck;
for (int i = 0; i < eachSize; ++i) {
for (int j = 0; j < handsSize; ++j) {
append(hands[j], temp);
temp = temp->after;
}
}
}
hands的值为
*hands=0x746365667265700e
hands[1]=NULL
hands[2]=NULL
hands[3]=0x00007fc44b402430
hands[4]=0x00007fc44b402570
为什么传入方法以后hands的长度增加了1?