Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7160073
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:20:16+00:00 2026-05-28T13:20:16+00:00

Ive just started C and I’m trying to do this queue implementation program from

  • 0

Ive just started C and I’m trying to do this queue implementation program from my book but it isn’t working. Its giving the error that function qfull and qempty are undefined. Even after properly declaring the function its still giving more errors.

#include <stdio.h>
#include <process.h>
#include <conio.h>
#define QUEUE_SIZE 5

void main()
{
    void insert_rear(int, int *, int *);
    void delete_front(int *, int *, int *);
    void display(int *, int, int);
    int choice, item, f, r, q[10];
    /* Queue is empty */
    f = 0; /* Front end of queue*/
    r = -1; /* Rear end of queue*/
    for (;;)
    {
        clrscr();
        printf("\t\t\t Ordinary Queue Operation\n\n");
        printf("\t\t\t 1 …. Push / Insert\n");
        printf("\t\t\t 2 …. Pop / Delete\n");
      printf("\t\t\t 3 …. View / Display\n");
        printf("\t\t\t 4 …. Exit\n\n\n");
        printf("\t\t\t Enter the choice : "); scanf("%d", &choice);
        switch (choice)
        {
            case 1: // push into the queue
                printf("Enter the item to be inserted : "); scanf("%d", &item);
                insert_rear(item, q, &r);
                continue;
         case 2: // pop from the queue
                delete_front(q, &f, &r);
                break;
            case 3: // display queue
                display(q, f, r);
                break;
            case 4:
                exit(0);
         default:
                printf("\t\t\tInvalid Input – Try Again");
        } // end of switch
        getch();
    }// end of for
} // end of main



/*******************/



void insert_rear(int item, int q[], int *r)
{
    if (qfull(*r)) /* Is queue full ? */
    {
        printf("\t\t\tQueue overflow\n");
        return;
    }
    /* Queue is not full */
    q[++(*r)] = item; /* Update rear pointer and insert a item */
}



/*—————————————————————– */



void delete_front(int q[], int *f, int *r)
{
    if (qempty(*f, *r))
    {
        printf("\t\t\tQueue underflow\n");
        return;
    }
    printf(" Pop Successfull, element deleted = %d ",q[(*f)++]);
    if(*f> *r)
    {
        *f=0,*r=-1;
    }
}



/*********************************************************/



void display(int q[], int f, int r)
{
    int i;
    if (qempty(f,r))
    {
        printf("Queue is empty\n");
        return;
    }
    printf("\t\t\t Queue Container\n\n");
    for(i=f;i<=r; i++)
        printf("\t\t\t| %5d |\n",q[i]);
}



/**********************************************/



int qempty(int f, int r)
{
    return (f>r)?1:0;
    /* returns true if queue is empty otherwise returns false */
}



/**********************************************/



int qfull(int r)
{ /* returns true if queue is full otherwise false */
    return (r==QUEUE_SIZE-1)?1:0;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T13:20:17+00:00Added an answer on May 28, 2026 at 1:20 pm

    You should put these declarations:

    void insert_rear(int, int *, int *);
    void delete_front(int *, int *, int *);
    void display(int *, int, int);
    

    outside of main (and above it). You also need to declare qfull and and qempty by these declarations. If a function isn’t defined in a file above where it is called, then it has to be declared above where it has been called. Otherwise, the compiler can’t ‘see’ them.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ive just started using WCF with silverlight and its working fine. But one thing
I've just started looking into Amazon's DynamoDB. Obviously the scalability appeals, but I'm trying
I've just started developing android apps and I am wondering about this right from
So ive just started learning python on WAMP, ive got the results of a
I've just started working on an ASP.NET project which I hope to open source
I've just started working with ASP.NET MVC now that it's in beta. In my
Ive just started using mutagen and have succefully used it with m4a , mp3
Ive just started using EF4 with the repository pattern. Im having to call the
I've just started to use PHPUnit, but I've run into a bit of a
this is a hw problem, ive done all the coding but im having trouble

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.