我正在制作指向结构的指针结构。我一直像疯子一样在谷歌上搜索,我不明白为什么下面的 printf 语句给出了不同的内存地址。有人可以向我解释一下吗?
struct board_piece {
board_piece* next;
board_piece* prev;
} board_piece;
main (int argc, char *argv []) {
board_piece *newPiece = malloc (sizeof (board_piece));
board_piece *newPiece2 = malloc (sizeof (board_piece));
newPiece->next = newPiece2;
printf("%x, %x", newPiece->next, newPiece2); //Why aren't these the same address?
}