本帖最后由 Cool_Breeze 于 2020-3-3 14:20 编辑 #include <stdio.h>
#include <malloc.h>
#define SIZE sizeof(struct test)
typedef struct test
{
int n;
struct test *next;
}*P;
int main()
{
P begin,end,head;
head=begin=end=(P)malloc(SIZE);
int i=0;
for (i=5;i<10;i+=2)
{
begin->n=i;
end=(P)malloc(SIZE);
begin->next=end;
begin=end;
}
end->next=NULL;
begin=head;
/*
对象指针->成员名 (结合性:左到右) 优先级 1
++变量名 (结合性:右到左)优先级 2
*/
for (;head->next;head=head->next)
{
printf("%d\n",head->n);
}
printf("%d\n",++begin->n);
return 0;
}
5
7
9
6
--------------------------------
Process exited after 0.005771 seconds with return value 0
请按任意键继续. . .
运算符的优先级和结合性 |