【问题标题】:Incompatible Pointers in == 中的不兼容指针
【发布时间】:2018-07-18 07:43:34
【问题描述】:

我不知道如何解决这个错误。我不能分配相同的类型。继续在='中接收'(严格)不兼容的指针

#define POOLSZ 53
typedef struct{
     int eventnr;
     int eventfq;
     struct olnode *next;
}olnode;

olnode pool[POOLSZ];
olnode *avail

void initpool()
{
    int i;

    for(i = 0; i < POOLSZ-1; i++)
        pool[i].next = &pool[i+1]; /*This is the error line */
    pool[i].next = NULL;
    avail = pool;
}

【问题讨论】:

    标签: c error-handling


    【解决方案1】:

    这一行指向struct olnode

    struct olnode *next;
    

    但是你没有定义这样的结构。你只有一个匿名结构,typedefed 到 olnode

    修复:

    typedef struct olnode {...} olnode;
    

    【讨论】:

    • 我没听懂,快看。
    • @IharobAlAsimi 第一眼也没看到,还得实际编译看看错误信息。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-04-12
    • 1970-01-01
    相关资源
    最近更新 更多