TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Query Array in Data Structure Using C Language
Sreenath Ks
Jan 05
2016
Code
1.2
k
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
It is a important in your life.please study and in another program.i help improved in your skill.
#
include < stdio.h >
int
rear = 0;
int
front = 0;
int
max = 25;
int
queue[100];
main() {
intch;
void
insert();
void
delete();
voidisempty();
voidisfull();
voidshowqueue();
do
{
int
data;
printf(
"\t*******QUEUE ARRAY********"
);
printf(
"\t==========================\n"
);
printf(
"\t 1:insert\n"
);
printf(
"\t 2:delete\n"
);
printf(
"\t 3:isempty\n"
);
printf(
"\t 4:isfull\n"
);
printf(
"\t 5:show queue\n"
);
printf(
"\t 7:stop\n"
);
printf(
"\t===========================\n"
);
printf(
"enter your choice\n"
);
scanf(
"%d"
, & ch);
switch
(ch) {
case
1:
// call insert function and BREAK after that
{
insert();
break
;
}
case
2:
// call delete function and BREAK after that
{
delete();
break
;
}
case
3:
// call isempty function and BREAK after that
{
isempty();
break
;
}
case
4:
// call isfull function and BREAK after that
{
isfull();
break
;
}
case
5:
// call show function and BREAK after that
{
showqueue();
break
;
}
case
6:
{
printf(
"program ended\n"
);
break
;
}
default
:
{
printf(
"enter valid choice"
);
break
;
}
}
}
// end of do while
while
(ch != 6);
}
//-------------------------------------------------------------//
void
insert()
//function to insert
{
int
data;
if
(rear == max) {
printf(
"queue is full\n"
);
}
else
{
rear = rear + 1;
printf(
"enter the data\n"
);
scanf(
"%d"
, & data);
queue[rear] = data;
printf(
"\t inserted data\n"
);
}
}
//-----------------------------------------------------------//
void
delete()
//function to delete
{
if
(rear == front) {
printf(
"\nstack is empty"
);
}
else
{
front = front + 1;
printf(
"%d"
, queue[front]);
printf(
"\n delete data"
);
}
}
//----------------------------------------------------------//
voidisempty()
//function to isempty
{
if
(rear == front) {
printf(
"queue is empty"
);
}
else
{
printf(
"queue is not empty"
);
}
}
//----------------------------------------------------------//
voidisfull()
//function to isfull
{
if
(rear == front) {
printf(
"queue is full"
);
}
else
{
printf(
"queue is not full"
);
}
}
//-----------------------------------------------------------//
voidshowqueue()
//function to top of stack
{
printf(
"data top of stack=%d\n"
, queue[rear]);
}
//------------------------------------------------------------//
Query Array
Data Structure
C