Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Incompatible Pointers in =

I do not know how to get around this error. I must not be assigning the same type. Keep receiving an '(strict) incompatible pointers in ='

#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;
}
like image 613
Ben Groseclose Avatar asked Mar 07 '23 22:03

Ben Groseclose


1 Answers

This line makes a pointer to struct olnode:

struct olnode *next;

But you don't define such struct. You only have an anonymous struct, typedefed to olnode.

Fix:

typedef struct olnode {...} olnode;
like image 144
HolyBlackCat Avatar answered Mar 10 '23 12:03

HolyBlackCat