typedef struct list_node
{
char* dataPtr;
struct list_node* next;
}ListNode;
typedef struct list
{
ListNode* head;
ListNode* tail;
}List;
void main()
{
List lst;
ListNode n1, n2, n3;
lst.head = &n1;
lst.tail = &n3;
n1.dataPtr = "one";
n1.next = &n2;
n2.dataPtr = "two";
n2.next = &n3;
n3.dataPtr = "three";
n3.next = NULL;
printf("Hello World!\n");
}
在使用调试器检查代码时,printf()
列表会丢失所有值。为什么?