I am getting a the warning "assignment from incompatible pointer type" when compiling my code, I have spent ages trying everything I can think of, but I am not very experienced at using C so it is probably something really simple that I just can't see.

I have commented the lines that are getting the warning

typedef struct{
	FILE *fp;
	int mem,timestart,timeend,wait;
	char name[50];
} process;

typedef struct{
        process *data;
        struct queue *next;
} queue; 

queue *readyfirst = NULL;
queue *readylast = NULL;
queue *blockedfirst[10] = {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};
queue *blockedlast[10] = {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};

void toready(process *p){
	queue *ready = malloc(sizeof(queue));
	ready->data = p;
	if(readyfirst == NULL){
		readyfirst = ready;
		readylast = ready;
	} else {
		readylast->next = ready; //warning: assignment from incompatible pointer type
		readylast = ready;	
		readylast->next = NULL;
	}
}

void checkblocked(){
	for(int i=0; i<10; i++){
		if(blockedfirst[i]->data->wait == 0){
			toready(blockedfirst[i]->data);
			blockedfirst[i] = blockedfirst[i]->next; //warning: assignment from incompatible pointer type
		}
	}
}
typedef struct{
        process *data;
        struct queue *next;
} queue;

The "struct queue" inside the typedef refers to an as yet undefined struct.

You need to name your struct, before you can point to it. Fortunately, this is easy to do, like so.

typedef struct queue_tag {
        process *data;
        struct queue_tag *next;
} queue;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.