Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Queue_using_array.c #33

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Queue_using_array.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//structure of Queue
struct queue
{
int front,rear,size;
int front=-1,rear=-1,size=0;
unsigned capacity;
int *array;
};
Expand All @@ -24,7 +24,7 @@ int isEmpty(struct queue *Queue)
return(Queue->size==0);
}

int isFULL(struct queue *Queue)
int isFull(struct queue *Queue)
{
return(Queue->size==Queue->capacity);
}
Expand All @@ -36,7 +36,7 @@ void enqueue(struct queue *Queue,int n)
Queue->rear=(Queue->rear+1)%Queue->capacity;
Queue->array[Queue->rear]=n;
Queue->size=Queue->size+1;
printf("Enqueued Element%d",n);
printf("\nEnqueued Element%d",n);
}

int dequeue(struct queue *Queue)
Expand Down Expand Up @@ -71,7 +71,7 @@ int main()
enqueue(Queue,16);

dequeue(Queue);
printf("Element At front %d\n\n",front(Queue));
printf("Element At Rear%d",rear(Queue));
printf("\nElement At front %d",front(Queue));
printf("\nElement At Rear %d",rear(Queue));
return 0;
}