Documente Academic
Documente Profesional
Documente Cultură
com/category/source-codes/)
> Software Programs (http://electrofriends.com/category/source-codes/software-programs/) > C Programs
(http://electrofriends.com/category/source-codes/software-programs/c/) > Data Structures
(http://electrofriends.com/category/source-codes/software-programs/c/data-structures-c/) > C program to
implement Circular Queue operations
Ads by Google
Java Code
C Program
Visual C
C Code
1 #include<stdio.h>
2 #define max 3
3 int q[10],front=0,rear=-1;
4 void main()
5 {
6
int ch;
Search
7
void insert();
8
void delet();
9
void display();
Register to Electrofrinds(http://electrofriends.com/register
)
Member Login
10
clrscr();
(http://electrofriends.com/wp-admin
)
11
printf("\\nnCircular Queue operations\\nn");
12
printf("1.insert\\nn2.delete\\nn3.display\\nn4.exit\\nn");
13
while(1)
14
{
15
printf("Enter your choice:");
16
scanf("%d",&ch);
17
switch(ch)
18
{
19
case 1: insert();
20
bbrreeaakk;
21
case 2: delet();
22
bbrreeaakk;
23
case 3:display();
24
bbrreeaakk;
25
case 4:exit();
26
default:printf("Invalid option\\nn");
27
}
28
}
29 }
30
31 void insert()
32 {
33
int x;
34
if((front==0&&rear==max-1)||(front>0&&rear==front-1))
35
printf("Queue is overflow\\nn");
36
else
37
{
38
printf("Enter element to be insert:");
39
scanf("%d",&x);
40
if(rear==max-1&&front>0)
41
{
42
rear=0;
43
q[rear]=x;
44
}
45
else
46
{
47
if((front==0&&rear==-1)||(rear!=front-1))
48
q[++rear]=x;
49
}
50
}
51 }
52 void delet()
53 {
54
int a;
55
if((front==0)&&(rear==-1))
56
{
57
printf("Queue is underflow\\nn");
58
getch();
59
exit();
60
}
61
if(front==rear)
62
{
63
a=q[front];
64
rear=-1;
(http://electrofriends.com)
65
front=0;
66
}
67
else
68
if(front==max-1)
69
{
70
a=q[front];
Search front=0;
71
72
}
73
else a=q[front++];
Register to Electrofrinds(http://electrofriends.com/register
)
Member Login
74
printf("Deleted element is:%d\\nn",a);
(http://electrofriends.com/wp-admin
)
75 }
76
77 void display()
78 {
79
int i,j;
80
if(front==0&&rear==-1)
81
{
82
printf("Queue is underflow\\nn");
83
getch();
84
exit();
85
}
86
if(front>rear)
87
{
88
for(i=0;i<=rear;i++)
89
printf("\\tt%d",q[i]);
90
for(j=front;j<=max-1;j++)
91
printf("\\tt%d",q[j]);
92
printf("\\nnrear is at %d\\nn",q[rear]);
93
printf("\\nnfront is at %d\\nn",q[front]);
94
}
95
else
96
{
97
for(i=front;i<=rear;i++)
98
{
99
printf("\\tt%d",q[i]);
100
}
101
printf("\\nnrear is at %d\\nn",q[rear]);
102
printf("\\nnfront is at %d\\nn",q[front]);
103
}
104
printf("\\nn");
105}
106getch();
(http://electrofriends.com)
(http://www.facebook.com/sharer.php?u=http:
(http://electrofriends.com)
//electrofriends.com/source-codes/software-programs/c/datastructures-c/c-program-to-implement-circular-queue-operations/)
(http://twitter.com/share?url=http://electrofriends.com
Search
/source-codes/software-programs/c/data-structuresc/c-program-to-implement-circular-queue-operations
Register to Electrofrinds(http://electrofriends.com/register
)
Member Login
(http://electrofriends.com/wp-admin
)
/&text=C+program+to+implement+Circular+Queue+operations+)
(http://www.digg.com/submit?url=http://electrofriends.com/sourcecodes/software-programs/c/data-structures-c/c-programto-implement-circular-queue-operations/)
(http://www.linkedin.com/shareArticle?mini=true&url=http:
//electrofriends.com/source-codes/software-programs/c/datastructures-c/c-program-to-implement-circular-queue-operations/)
(http://www.stumbleupon.com/submit?url=http:
//electrofriends.com/source-codes/software-programs/c/datastructures-c/c-program-to-implement-circular-queue-operations
/&title=C program to implement Circular Queue operations)
(http://www.tumblr.com/share/link?url=electrofriends.com/sourcecodes/software-programs/c/data-structures-c/c-programto-implement-circular-queue-operations/&name=C program to
implement Circular Queue operations)
(https://plus.google.com
/share?url=http://electrofriends.com/source-codes/softwareprograms/c/data-structures-c/c-program-to-implement-circularqueue-operations/)
(mailto:?Subject=C program to implement
Circular Queue operations&Body=%20http://electrofriends.com
/source-codes/software-programs/c/data-structuresc/c-program-to-implement-circular-queue-operations/)
Related Posts
(http://electrofriends.com)
Search
Register to Electrofrinds
(http://electrofriends.com/register
)
Member Login
(http://electrofriends.com
(http://electrofriends.com
(http://electrofriends.com
(http://electrofriends.com
(http://electrofriends.com/wp-admin
)
/source/source/source/sourcecodes/softwarecodes/softwarecodes/softwarecodes/softwareprograms/c/data- programs
programs/c/data- programs/c/datastructures/cpp-programs
structuresstructuresc/c-program/cpp-datac/c-programc/c-programfor-circular-queue- structure
which-convertsto-implementoperations-using- /c-programgiven-expression- queuearray/)
to-implementinto-its-post-xoperations/)
circular-queueformat/)
C Program for
C program to
adt-usingCircular QUEUE
C program which
implement queue
an-array/)
Operations
converts given
operations
using Array
C++ program to
expression into its (http://electrofriends.com
(http://electrofriends.com
implement circular post-x format
/source/sourcequeue ADT using
(http://electrofriends.com
codes/softwarecodes/softwarean array
/sourceprograms/c/dataprograms/c/data- (http://electrofriends.com
codes/softwarestructuresstructures/sourceprograms/c/data- c/c-programc/c-programcodes/softwarestructuresto-implementfor-circular-queue- programs
c/c-programqueueoperations-using- /cpp-programs
which-convertsoperations/)
array/)
/cpp-datagiven-expressionstructure
into-its-post-x/c-programformat/)
to-implementcircular-queueadt-usingan-array/)
(http://electrofriends.com
(http://electrofriends.com
(http://electrofriends.com
(http://electrofriends.com
/source/source/source/sourcecodes/softwarecodes/softwarecodes/softwarecodes/softwareprograms/c/data- programs
programs/c/data- programs/c/datastructures/cpp-programs
structuresstructuresc/c-program/cpp-advancedc/c-programc/c-programto-implementprograms
to-implementfor-singly-linkedlinked-list/)
/c-programqueue-operations- list-operations/)
to-implementusing-linked-lists/) C Program for
C program to
circular-queueimplement linked
C Program to
Singly Linked List
using-array/)
list
implement QUEUE Operations
(http://electrofriends.com
C++ program to
operations using
(http://electrofriends.com
/sourceimplement circular Linked Lists
/sourcecodes/softwarequeue using array (http://electrofriends.com
codes/software-
(http://electrofriends.com)
Search
Register to Electrofrinds(http://electrofriends.com/register
)
Member Login
(http://electrofriends.com/wp-admin
)
Drithi (http://electrofriends.com/author/drithi/)
Read More About this author (http://electrofriends.com/members/drithi)
programs/c/data-structures-c/c-program-to-implement-circular-queueoperations/comment-page-1/#comment-10370)
codes/software-programs/c/data-structures-c/c-program-to-implementcircular-queue-operations/comment-page-1/#comment-57677)
(http://electrofriends.com)
Reply (/source-codes/software-programs/c/data-structuresc/c-program-to-implement-circular-queue-operations
/?replytocom=57677#respond)
Search
Register to Electrofrinds(http://electrofriends.com/register
)
Member Login
(http://electrofriends.com/wp-admin
)
/source-codes/software-programs/c/data-structures-c/c-programto-implement-circular-queue-operations/comment-page-1/#comment70501)
codes/software-programs/c/data-structures-c/c-program-to-implementcircular-queue-operations/comment-page-1/#comment-80154)
display func will not work when u add one element in queue and thn
u delete it.only one element
Reply (/source-codes/software-programs/c/data-structuresc/c-program-to-implement-circular-queue-operations
/?replytocom=80154#respond)
programs/c/data-structures-c/c-program-to-implement-circular-queueoperations/comment-page-1/#comment-118194)
codes/software-programs/c/data-structures-c/c-program-to-implementcircular-queue-operations/comment-page-1/#comment-120981)
Reply (/source-codes/software-programs/c/data-structures(http://electrofriends.com)
c/c-program-to-implement-circular-queue-operations
/?replytocom=120981#respond)
Search
praveen (http://electrofriends.com)
August
25, 2015 (http://electrofriends.com
Register to Electrofrinds
(http://electrofriends.com/register
)
Member Login
/source-codes/software-programs/c/data-structures-c/c-program(http://electrofriends.com/wp-admin
)
to-implement-circular-queue-operations/comment-page-1/#comment126452)
programs/c/data-structures-c/c-program-to-implement-circular-queueoperations/comment-page-1/#comment-127958)
thank you so muchu are doing such a nice work helping needy
studentlove ur site
Reply (/source-codes/software-programs/c/data-structuresc/c-program-to-implement-circular-queue-operations
/?replytocom=127958#respond)
codes/software-programs/c/data-structures-c/c-program-to-implementcircular-queue-operations/comment-page-1/#comment-128525)
codes/software-programs/c/data-structures-c/c-program-to-implementcircular-queue-operations/comment-page-1/#comment-129362)
Nice program.
Reply (/source-codes/software-programs/c/data-structuresc/c-program-to-implement-circular-queue-operations
/?replytocom=129362#respond)
(http://electrofriends.com)
Leave
a Reply
Search
Name (required)
Register to Electrofrinds(http://electrofriends.com/register
)
Member Login
(http://electrofriends.com/wp-admin
)
Website
Comment
Submit Comment
TAG CLOUD
linked list (http://electrofriends.com/tag/linked-list/) microprocessor (http://electrofriends.com
/tag/microprocessor-2/) c graphics (http://electrofriends.com/tag/c-graphics/) ASM program
(http://electrofriends.com/tag/asm-program/) Data structure (http://electrofriends.com/tag/data-
Email:
(http://electrofriends.com)
Member Login
(http://electrofriends.com/source-codes/software-programs/c/data-structures-c/c-program(http://electrofriends.com/wp-admin
)
for-simple-dsc-order-priority-queue-implementation-using-structure-2/)
C Program for Simple DSC order Priority QUEUE Implementation using Structure
(http://electrofriends.com/source-codes/software-programs/c/data-structures-c/c-programfor-simple-dsc-order-priority-queue-implementation-using-structure/)
C Program for Simple ASC order Priority QUEUE Implementation using Structure
(http://electrofriends.com/source-codes/software-programs/c/data-structures-c/c-programfor-simple-asc-order-priority-queue-implementation-using-structure/)
C Program for Simple DSC order Priority QUEUE Implementation (http://electrofriends.com
/source-codes/software-programs/c/data-structures-c/c-program-for-simple-dsc-order-priorityqueue-implementation/)
C Program for Simple ASC order Priority QUEUE Implementation (http://electrofriends.com
/source-codes/software-programs/c/data-structures-c/c-program-for-simple-asc-order-priorityqueue-implementation/)
C Program to convert Prex Expression into Postx (http://electrofriends.com/sourcecodes/software-programs/c/data-structures-c/c-program-to-convert-prex-expressioninto-postx/)
C Program for Inx to Prex Conversion (http://electrofriends.com/source-codes/softwareprograms/c/data-structures-c/c-program-for-inx-to-prex-conversion/)
C Program for Binary Search Tree Creation and Traversals (http://electrofriends.com/sourcecodes/software-programs/c/data-structures-c/c-program-for-binary-search-tree-creationand-traversals/)
Program for Doubly Linked List Operations (http://electrofriends.com/source-codes/softwareprograms/c/data-structures-c/program-for-doubly-linked-list-operations/)
Recent Questions
need help in arduino, on delay button. (http://electrofriends.com/questions/needhelp-in-arduino-on-delay-button/)
C++ program for automated solar inverter (http://electrofriends.com/questions
/c-program-for-automated-solar-inverter/)
Pig Latin (http://electrofriends.com/questions/pig-latin/)
what does a pointer variable equated to another pointer variable do(abc=xyz)?
(http://electrofriends.com/questions/what-does-a-pointer-variable-equated-to-anotherpointer-variable-doabcxyz/)
Wedding Dresses (http://electrofriends.com/questions/wedding-dresses/)
Question Tags
Algorithm time complexity (http://electrofriends.com/questions/tags/algorithm-time-complexity/) avl tree
c
(http://electrofriends.com/questions
/tags/c-questions/) c++
(http://electrofriends.com/questions
Search
/tags/c-2/)
(http://electrofriends.com)
(http://electrofriends.com/questions/tags/avl-tree/)
Member Login
(http://electrofriends.com/wp-admin
)
(http://electrofriends.com/questions/tags/junction-resistance/) lexical analysis (http://electrofriends.com
/questions/tags/lexical-analysis/) local variable (http://electrofriends.com/questions/tags/local-variable/)
operator (http://electrofriends.com/questions/tags/operator-2/) please help me before 25 th october 2014.
(http://electrofriends.com/questions/tags/please-help-me-before-25-th-october-2014/) series resistance
(http://electrofriends.com/questions/tags/series-resistance/) singleton c++ clone (http://electrofriends.com
/questions/tags/singleton-c-clone/) sizeof (http://electrofriends.com/questions/tags/sizeof/)
Electrofriends
8,085 likes
Like Page
Share
Recent
Comments
Search
(http://electrofriends.com/interview-questions/it-c-interview-questions/18-predict-outputRegister to Electrofrinds(http://electrofriends.com/register
)
Member Login
(http://electrofriends.com/wp-admin
)
errors-code/)
18. Predict the output or error(s) of the following c code (http://electrofriends.com/interviewquestions/it-c-interview-questions/18-predict-output-errors-code/)
C Interview Questions
(http://electrofriends.com/interview-questions/it-c-interview-questions/4-predict-outputerrors-code/)
4. Predict the output or error(s) of the following c code (http://electrofriends.com/interviewquestions/it-c-interview-questions/4-predict-output-errors-code/)
C Interview Questions
(http://electrofriends.com/projects/microcontrollers/digital-code-lock-using-at89c2051/)
Digital Code lock using AT89C2051 (http://electrofriends.com/projects/microcontrollers/digitalcode-lock-using-at89c2051/)
Microcontroller Student Projects
(http://electrofriends.com/source-codes/digital-electroninc/verilog-hdl/veriloghdl-program-for-serail-in-parallel-out-shift-register/)
Verilog HDL Program for Serail In Parallel Out Shift Register (http://electrofriends.com
/source-codes/digital-electroninc/verilog-hdl/verilog-hdl-program-for-serail-in-parallel-out-shiftregister/)
Verilog HDL
(http://electrofriends.com/articles/electronics/microcontroller-electronics-articles
/8051-8951/8051-microcontroller-port-programming/)
8051 Microcontroller port programming (http://electrofriends.com/articles/electronics
/microcontroller-electronics-articles/8051-8951/8051-microcontroller-port-programming/)
8051/8951
(http://electrofriends.com/source-codes/software-programs/cpp-programs/cpp-datastructure/program-for-array-based-representation-of-linear-list-using-templates/)
Program for Array Based Representation of Linear List using templates
(http://electrofriends.com/source-codes/software-programs/cpp-programs/cpp-data-structure
/program-for-array-based-representation-of-linear-list-using-templates/)
Data structure
(http://electrofriends.com)
(http://electrofriends.com/qna/software-languages/c-cpp-faq/how-to-allocatetwo-dimensional-array/)
How to allocate two dimensional array? (http://electrofriends.com/qna/software-languages
Search
/c-cpp-faq/how-to-allocate-two-dimensional-array/)
C/C++
Register to Electrofrinds(http://electrofriends.com/register
)
Member Login
(http://electrofriends.com/wp-admin
)
Subscribe
Subscribe
FOLLOW US
(https://www.facebook.com/electrofriends)
(https://twitter.com/electrofriends)
(http://electrofriends.com
/feed/)
(http://electrofriends.com)
This is the one stop educational site for all Electronic and Computer students. If you
want to learn something new then we are here to help. We work on Microcontroller
projects, Basic Electronics, Digital electronics, Computer projects and also in basic
c/c++ programs.
(http://electrofriends.com)
Search
Register to Electrofrinds(http://electrofriends.com/register
)
Member Login
(http://electrofriends.com/wp-admin
)