ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip   To Refer this Site to Your Friends   Click Here
Google
 
Categories  >>  Software  >>  Programming Languages  >>  C
 
 


 

 
 C interview questions  C Interview Questions
 C++ interview questions  C++ Interview Questions
 VC++ interview questions  VC++ Interview Questions
 Delphi interview questions  Delphi Interview Questions
 Programming Languages AllOther interview questions  Programming Languages AllOther Interview Questions
Question
sir,
   i cannot find the way how to write aprogram by using 
array on queue
 Question Submitted By :: Prasanna Nayak
I also faced this Question!!     Rank Answer Posted By  
 
  Re: sir, i cannot find the way how to write aprogram by using array on queue
Answer
# 1
#include<stdio.h>
#include<conio.h>
void insert();
void del();
void trav();
int f=-1,r=-1,a[20],n=5;
int main()
{
    int ch;
    char ch1='y';
    clrscr();
    while(ch1=='y')
    {
    printf("\nMEnu ");
    printf("\n1.Insertion ");
    printf("\n2.Deletion ");
    printf("\n3.Traversal ");
    printf("\n4.Exit ");
    printf("\nEnter your chioce ");
    scanf("%d",&ch);
    switch(ch)
    {
    case 1:
	 insert();
	 break;
	case 2:
	      del();
	      break;
	      case 3:
		   trav();
		   break;
		   case 4:
			exit(0);
    }
    printf("\nDo you want to repeat ");
    ch1=getche();
}
}
void insert()
{
     int item;
     if(r<n-1)
     {
     printf("\nEnter the element ");
     scanf("%d",&item);
     if(f==-1)
     {
	    f=0;
	    r=0;
     }
     else

	 r=r+1;
	 a[r]=item;
     }
}
void del()
{
if((f>=0)&&(f<=r))
{
f=f+1;
printf("\nItem is deleted ");
}
else
{
printf("\nUnderflow ");
}
}
void trav()
{
int i;
if((f==-1)||(f>r))
{
printf("\nQueue is empty ");
}
for(i=f;i<=r;i++)
{
printf("%d\n",a[i]);
}
}
 
Is This Answer Correct ?    0 Yes 0 No
Ruchi
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
what is the stackpointer  2
c programming of binary addition of two binary numbers  1
what is diff between localstatic and globalstatis variable possible 2 use in another file...? HCL2
What is #pragma directive?how it is used in the program? what is its advantages and disadvantages?  1
What is difference between the following 2 lines…. int temp = (int)(0x00); int temp = (0x00int); Bosch3
Write code for initializing one dimentional and two dimentional array in a C Program? Deshaw5
While(1) { } when this loop get terminate is it a infinite loop?  4
int *p=20; if u print like dis printf("%d",p); o\p:- 20; how is it possible? plz give me the explanation. Global-Edge11
WHAT IS THE DIFFERANCE BITWIN GETS();AND SCANF();  2
What is the value of y in the following code? x=7;y=0; if(x=6) y=7; else y=1; TCS10
swap two integer variables without using a third temporary variable?  2
Software Interview Questions CAT1
write a program that explain #define and # undef directive  1
I have an array of 100 elements, each of which is a random integer. I want to know which of the elements: a) are multiples of 2 b) are multiples of 2 AND 5 c) have a remainder of 3 when divided by 7  1
what is difference between array of characters and string Accenture10
which of the function operator cannot be over loaded a) <= b)?: c)== d)* HCL7
totally how much header files r in c language TCS4
Hi, main() { } Is a user defined function or Built in Functionn Honeywell9
write a 'c' program to sum the number of integer values  5
How can I return multiple values from a function?  4
 
For more C Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com