struct _node *next;
} Node;
Why does sizeof(Node); // 16 ?
data alignment
?
Keyword: Padding Struct.
Compiler adds padding to struct for efficient memory access.
On 64 bit machine, this will give you sizeof(Node) == 12. typedef struct __attribute__((packed)) _node { int number; struct _node *next; } Node;
http://www.catb.org/esr/structure-packing/
Обсуждают сегодня