assignment from incompatible pointer type

Posted by Hristo on Stack Overflow See other posts from Stack Overflow or by Hristo
Published on 2010-04-21T14:45:45Z Indexed on 2010/04/21 14:53 UTC
Read the original article Hit count: 157

Filed under:
|
|

I have set up the following struct:

typedef struct _thread_node_t {
    pthread_t thread;
    struct thread_node_t *next;
} thread_node_t;

... and then I have defined:

// create thread to for incoming connection
thread_node_t *thread_node = (thread_node_t*) malloc(sizeof(thread_node_t));
pthread_create(&(thread_node->thread), NULL, client_thread, &csFD);

thread_node->next = thread_arr; // assignment from incompatible pointer type

thread_arr = thread_node;

where thread_arr is thread_node_t *thread_arr = NULL;

I don't understand why the compiler is complaining. Maybe I'm misunderstanding something.

© Stack Overflow or respective owner

Related posts about error

Related posts about c