diff --git a/main.c b/main.c index 443b4ba..93f674c 100644 --- a/main.c +++ b/main.c @@ -12,12 +12,12 @@ int main() { char sched_policy[4]; - int policy; + enum Policy policy; int nproc; struct process *proc; scanf("%4s", sched_policy); - + if (strcmp(sched_policy, "FIFO") == 0) { policy = FIFO; } @@ -39,7 +39,7 @@ int main() fprintf(stderr, "Invalid number of processes.(Or policy exceeds 4 characters)"); exit(0); } - + proc = (struct process *)malloc(nproc * sizeof(struct process)); for (int i = 0; i < nproc; i++) { diff --git a/scheduler.h b/scheduler.h index 31419c4..735a6c9 100644 --- a/scheduler.h +++ b/scheduler.h @@ -3,11 +3,8 @@ #include "process.h" -#define FIFO 1 -#define RR 2 -#define SJF 3 -#define PSJF 4 +enum Policy{FIFO, RR, SJF, PSJF}; -void schedule(struct process *, int num_proc, int policy); +void schedule(struct process *, int num_proc, enum Poilcy policy); -#endif \ No newline at end of file +#endif