我正在实现优先级队列,并尝试使用以下代码检查优先级,但是不幸的是,这出错了。
int i = 0;
int checker =-1;
printf("inserted priority:%d\n", *job.priority);
if(*job.priority == checker){//first arrival
printf("priority of first arrival:%d\n",QueueNum);
*job.priority = QueueNum;
}
else{
printf("why are u running\n");
printf("wtf priority:%d\n", *job.priority);
}
我使用printf()
来跟踪值的变化,并显示结果
inserted priority:-1
why are u running
wtf priority:-1218044757
我不知道是什么原因导致更改?我该如何解决?