指针的一些问题
#include<stdio.h>#include<stdlib.h>
struct test
{
int data;
struct test *next;
};
int main()
{
struct test *p , *q;
q = p = (struct test*)malloc(sizeof(struct test));
p->data=3;
q->next=p;
q=p;
p = (struct test*)malloc(sizeof(struct test));
p->data=4;
printf("%d" , q->data);
return 0;
}
为什么这个打印的是3而不是4