标签:优先级
今天调试程序时,遇到这么一个错误:
error C2227: left of ‘->first‘ must point to class/struct/union
#include
using namespace std;
#define ElemType int
struct node
{
struct node *first;
struct node *last;
int size;
};
typedef struct node Node;
typedef struct node *PNode;
typedef PNode List;
void Initlist(List *list)
{
*list->first = *list->last = (node *)malloc(sizeof(node));
*list->size = 0;
}
int main()
{
List mylist;
Initlist(&mylist);
return 0;
}
错误如下:
到底哪出错了呢?????
。
。
。
原来:->优先级(高于)*
*list->last ===>>>>>*(list->last),*list是指向结构体的指针,而list不是,,现在知道错误的原因所在了吧!!!注意哦!!
将*list->last -------改为-------->>>(*list)->last,问题就解决了
标签:优先级
原文:http://blog.csdn.net/zongyinhu/article/details/45288845