know the personalities
hold your mouse,move left and right

DataStructure-Program that implements queue as an array.


job detailsFree Publishing of valuable information(s) in our website-Procedure to submit detailsjob details

Free Publishing of your College/University function details


Free Publishing of Your College/University function details in our website.Please send details to following email ids


technicalsymposium@gmail.com.
technicalsymposium@in.com.
technicalsymposium@yahoo.com.
technicalsymposium@hotmail.com.
Google Groups

Get Free E-Mail Alerts Daily

Get Daily Job/EntranceExam/Scholarships/
Admission/Competitive Exam Details Symposium/Conference Alerts in your email

Please Enter your email id and go to your inbox and confirm.You will be a member in our group.

Email:
Visit this group

Freshers Jobs/Symposium/Conference/Certification &Education News Given Below-Get Now

Freshers Jobs and IT /Govt Jobs

Symposium and Conference Details

Free Lecture Notes

Free Placement Papers

Free Project Codings


                

DataStructure-Program that implements queue as an array.

#include <stdio.h>
#include <conio.h>
#define MAX 10
void addq ( int *, int, int *, int * ) ;
int delq ( int *, int *, int * ) ;
void main( )
{
int arr[MAX] ;
int front = -1, rear = -1, i ;
clrscr( ) ;
addq ( arr, 23, &front, &rear ) ;
addq ( arr, 9, &front, &rear ) ;
addq ( arr, 11, &front, &rear ) ;
addq ( arr, -10, &front, &rear ) ;
addq ( arr, 25, &front, &rear ) ;
addq ( arr, 16, &front, &rear ) ;
addq ( arr, 17, &front, &rear ) ;
addq ( arr, 22, &front, &rear ) ;
addq ( arr, 19, &front, &rear ) ;
addq ( arr, 30, &front, &rear ) ;
addq ( arr, 32, &front, &rear ) ;
i = delq ( arr, &front, &rear ) ;
printf ( "\nItem deleted: %d", i ) ;
i = delq ( arr, &front, &rear ) ;
printf ( "\nItem deleted: %d", i ) ;
i = delq ( arr, &front, &rear ) ;
printf ( "\nItem deleted: %d", i ) ;
getch( ) ;
}
/* adds an element to the queue */
void addq ( int *arr, int item, int *pfront, int *prear )
{
if ( *prear == MAX - 1 )
{
printf ( "\nQueue is full." ) ;
return ;
}
( *prear )++ ;
arr[*prear] = item ;
if ( *pfront == -1 )
*pfront = 0 ;
}
/* removes an element from the queue */
int delq ( int *arr, int *pfront, int *prear )
{
int data ;
if ( *pfront == -1 )
{
printf ( "\nQueue is Empty." ) ;
return NULL ;
}
data = arr[*pfront] ;
arr[*pfront] = 0 ;
if ( *pfront == *prear )
*pfront = *prear = -1 ;
else
( *pfront )++ ;
return data ;
}

Hosting by Yahoo!

About-Us    Contact-Us    Site-map

©copyright 2009 All rights are reserved to technicalsymposium.com