Hocanın derste verdiği kuyruk modülleri 5 tane error, 1 tane warning veriyor!
Bu modüller ile bu ödevi nasıl yapacaz, bilemiyorum!
#include <stdio.h>
#include <stdlib.h>
#define MAXQ 100
struct queue {
int items[MAXQ];
int front, rear;
}
struct queue q;
q.front = q.rear = MAXQ-1;
int empty(struct queue *pq) {
return (pq->front == pq->rear) ? true : false;
}
int remove(struct queue *pq) {
if(empty(pq)) {
printf("%s","kuyruk bos!");
exit(1);
}
if(pq->front == MAXQ-1)
pq->front = 0;
else
pq->front ++;
return (pq->items[pq->front]);
}
void insert(struct queue *pq, int x) {
if(pq->rear == MAXQ-1)
pq->rear = 0;
else
pq->rear ++;
if(pq->rear == pq->front) {
printf("%s", "Kuyruk dolu!");
exit(1);
}
pq->items[pq->rear] = x;
return;
}
Bunlar da hatalar:
--------------------Configuration: banka_kuyruk - Win32 Debug--------------------
Compiling...
source.c
d:\activeprojects\banka_kuyruk\source.c(10) : error C2236: unexpected 'struct' 'queue'
d:\activeprojects\banka_kuyruk\source.c(11) : error C2143: syntax error : missing '{' before '.'
d:\activeprojects\banka_kuyruk\source.c(11) : error C2059: syntax error : '.'
d:\activeprojects\banka_kuyruk\source.c(13) : error C2065: 'true' : undeclared identifier
d:\activeprojects\banka_kuyruk\source.c(13) : error C2065: 'false' : undeclared identifier
d:\activeprojects\banka_kuyruk\source.c(15) : warning C4028: formal parameter 1 different from declaration
Error executing cl.exe.
source.obj - 5 error(s), 1 warning(s)
Let`s make this world a better place to live !
|