Best C Programming code for Circular Queue using Static Memory Allocation – February,2021

#include<stdio.h>
#include<stdlib.h>

#define max 5

typedef struct Queue
{
int val[max];
int rear,front;
}qu;

void enque(qu *,int);
int deque(qu*);
int peek(qu);
int isempty(qu);
int isfull(qu);
void disp(qu);


void main()
{
qu q;
int g,v;
q.rear=q.front=-1;
while(1)
{
printf("\n1) Insert\n2) Delete\n3) Peek\n4) Display\n5) Exit");
printf("\n Enter your choice : ");
scanf("%d",&g);
switch(g)
{
case 1: printf("\n Enter the value : ");
 scanf("%d",&v);
 if(!isfull(q))
  enque(&q,v);
 else
  printf("\nNo more space");
 break;
case 2: if(!isempty(q))
  printf("\nDeleted element is %d",deque(&q));
 else
  printf("\nNothing to delete");
 break;
case 3:
 if(!isempty(q))
  printf("\n value at front %d",peek(q));
 else
  printf("\n Nothing in the front");
 break;
case 4: if(!isempty(q))
  {
  printf("\nValues in the queue : ");
  disp(q);
  }
 else
  printf("\nNothing to display");
 break;
case 5: exit(0);
default: printf("\n wrong choice");
}
}
}


void enque(qu *q,int p)
{
 if(q->rear==-1)
  q->rear=q->front=0;
 else if(q->rear==max-1)
  q->rear=0;
 else
  q->rear++;
 q->val[q->rear]=p;
}

int deque(qu *q)
{
int g;
g=q->val[q->front];
 if(q->front==q->rear)
  q->rear=q->front=-1;
 else if(q->front==max-1)
  q->front=0;
 else
  q->front++;
return g;
}


int peek(qu q)
{
return q.val[q.front];
}

int isempty(qu q)
{
if((q.front==-1 && q.rear==-1))
return 1;
else
return 0;
}

int isfull(qu q)
{
if((q.front==0 && q.rear==max-1) || q.front==q.rear+1)
return 1;
else
return 0;
}

void disp(qu q)
{
int i;
if(q.front>q.rear)
{
for(i=q.front;i<=max-1;i++)
printf("%d,",q.val[i]);

for(i=0;i<=q.rear;i++)
printf("%d,",q.val[i]);
}
else
for(i=q.front;i<=q.rear;i++)
printf("%d,",q.val[i]);
}

This Post Has 169 Comments

  1. Bob

    My brother suggested I might like this web site.
    He was entirely right. This post actually made my day. You cann’t
    imagine simply how much time I had spent for this information! Thanks!

  2. freeholmes.com

    Terrific work! This is the type of info that are supposed to be shared across the web.
    Shame on the seek engines for not positioning this submit higher!
    Come on over and visit my site . Thank you =)

    my web-site … download game mega888 (freeholmes.com)

  3. Nice blog here! Additionally your site a lot up very
    fast! What web host are you the usage of? Can I get your affiliate link on your host?
    I wish my website loaded up as fast as yours lol

    Also visit my blog post :: download game mega88

  4. demo mega888

    What’s up everyone, it’s my first pay a quick visit at this web site, and
    paragraph is really fruitful designed for me,
    keep up posting these types of articles or reviews.

    Look at my homepage demo mega888

  5. gantdaily.com

    I was honored to obtain a call coming from a
    friend as soon as he uncovered the important ideas shared on your
    own site. Looking at your blog write-up is a real great experience.
    Thanks again for considering readers much like me, and I hope for you
    the best of success as a professional in this
    domain.

    Visit my homepage – gantdaily.com

  6. Howdy! I know this is kinda off topic however ,
    I’d figured I’d ask. Would you be interested in trading
    links or maybe guest writing a blog post or vice-versa?
    My blog addresses a lot of the same topics as yours and I believe we
    could greatly benefit from each other. If you are interested feel free to send me an email.
    I look forward to hearing from you! Great blog by the
    way!

    Feel free to visit my webpage; download mega888 original

  7. This design is spectacular! You most certainly know how
    to keep a reader amused. Between your wit and your videos, I was almost moved to
    start my own blog (well, almost…HaHa!) Excellent job.
    I really loved what you had to say, and more than that, how you presented it.
    Too cool!

    my blog mega888 android download

  8. Hi there! I could have sworn I’ve been to this site before but after reading through some of the post I realized it’s new to me.
    Anyhow, I’m definitely happy I found it and I’ll be bookmarking and checking back frequently!

    My website; 918kaya maintenance

  9. Howdy, i read your blog from time to time and i
    own a similar one and i was just curious if you get a lot of spam responses?
    If so how do you stop it, any plugin or anything you can recommend?
    I get so much lately it’s driving me crazy so any help
    is very much appreciated.

    Feel free to surf to my web blog free download game mega888

  10. Wonderful beat ! I wish to apprentice while you amend your website,
    how can i subscribe for a blog website? The account aided me a acceptable deal.
    I had been a little bit acquainted of this your broadcast provided bright clear concept

    my website kiss918 download android

  11. www.brq520.com

    Wow, superb blog structure! How lengthy have you ever been running a blog for?
    you make running a blog glance easy. The entire look of
    your site is great, as well as the content material!

    Feel free to visit my website – http://www.brq520.com

  12. 918kiss xe88

    This website really has all the info I needed concerning this subject and didn’t know who to ask.

    Also visit my homepage – 918kiss xe88

  13. pussy888app

    This blog was… how do I say it? Relevant!! Finally I’ve found something which helped me.
    Many thanks!

    My webpage … pussy888app

  14. angpao xe88

    Hello! This is kind of off topic but I need some advice from an established blog.
    Is it hard to set up your own blog? I’m not very techincal but I can figure things out pretty fast.
    I’m thinking about setting up my own but I’m not sure where to begin. Do you have any tips or
    suggestions? Many thanks

    Take a look at my webpage: angpao xe88

  15. 918kaya download

    Howdy, i read your blog occasionally and i own a similar one and i was just curious if you get a
    lot of spam feedback? If so how do you reduce it,
    any plugin or anything you can suggest? I get so
    much lately it’s driving me insane so any support is very much appreciated.

    My blog; 918kaya download

  16. Hello there, I do believe your web site might be having internet browser compatibility issues.
    Whenever I take a look at your website in Safari, it looks fine however, when opening in Internet
    Explorer, it’s got some overlapping issues. I merely wanted to give you a quick heads up!
    Other than that, fantastic website!

    My blog post … pussy888 apk, wiki.trumpchannel.org,

  17. Download Mega888

    We are a gaggle of volunteers and starting a new scheme in our
    community. Your website provided us with useful info to work on. You’ve
    performed a formidable task and our entire group will probably be thankful
    to you.

    Also visit my blog post :: Download Mega888

  18. Buster

    You are so awesome! I do not suppose I’ve read through a single thing like
    that before. So good to discover someone with a few original thoughts on this
    subject matter. Seriously.. many thanks for starting this up.
    This website is one thing that’s needed on the web,
    someone with a little originality!

    Feel free to surf to my web site :: mega888 original (Buster)

  19. dominoqq

    Thanks fߋr thе mаrvelous posting! I definitely enjoyed readfing
    it, you might be a great author.I wіll ensսre that I bookmark your
    Ьlog and ⅾefinitely will come back sometime soon. I want to encourage you to continue
    үour great ԝork, hаve a nice morning!

  20. mega888 test id

    you are truly a good webmaster. The site loading speed is amazing.
    It sort of feels that you are doing any unique
    trick. Furthermore, The contents are masterwork.
    you’ve performed a magnificent process in this topic!

    Check out my web-site mega888 test id

  21. Right here is the perfect website for everyone who would like to find out about this topic.
    You realize a whole lot its almost hard to argue with you (not that I
    personally would want to…HaHa). You definitely put a new spin on a subject that
    has been discussed for a long time. Great stuff, just excellent!

    Also visit my web page: xe88 game (cashflowandflip.com)

  22. xe888 apk

    Right here is the right blog for everyone who really wants to find out about this
    topic. You realize a whole lot its almost hard to argue with you (not that I actually would want to…HaHa).
    You definitely put a brand new spin on a topic that’s been discussed
    for many years. Great stuff, just great!

    Here is my website :: xe888 apk

  23. hytaleturk.com

    Its like you read my mind! You appear to know so much about this, like you wrote the book in it
    or something. I think that you can do with a few pics to drive the
    message home a little bit, but other than that, this is excellent blog.
    An excellent read. I’ll definitely be back.

    Feel free to surf to my site – hytaleturk.com

  24. Howdy just wanted to give you a quick heads up.
    The text in your content seem to be running off the screen in Safari.
    I’m not sure if this is a formatting issue or something to
    do with web browser compatibility but I thought I’d post to let you know.
    The design and style look great though! Hope you get the problem
    solved soon. Thanks

  25. hey there and thank you for your info ? I have definitely picked up something new from right here.
    I did however expertise a few technical issues using this site, as I experienced to reload
    the site lots of times previous to I could get it to load correctly.
    I had been wondering if your web hosting is OK?

    Not that I’m complaining, but sluggish loading instances times will often affect your placement in google and
    can damage your high-quality score if ads and marketing with Adwords.
    Well I’m adding this RSS to my email and can look out for a lot more of your respective exciting content.
    Ensure that you update this again very soon.

    My web page: http://www.johnsonclassifieds.com/user/profile/3875920

  26. Rhoda

    Hi Dear, are you truly visiting this site daily, if so after that you will definitely obtain fastidious experience.

  27. 918kaya kiosk

    It’s in point of fact a nice and helpful piece of info.
    I am happy that you just shared this helpful info with us.
    Please stay us up to date like this. Thanks for sharing.

    Take a look at my webpage :: 918kaya kiosk

  28. Hey! This is kind of off topic but I need some
    help from an established blog. Is it very hard to set up
    your own blog? I’m not very techincal but I can figure things
    out pretty quick. I’m thinking about making my own but I’m not sure where to
    start. Do you have any ideas or suggestions? With thanks

  29. I would like to thank you for the efforts you’ve put in writing this blog.
    I really hope to view the same high-grade blog posts by you later on as well.
    In truth, your creative writing abilities has encouraged me
    to get my own blog now 😉

  30. 918kaya kiosk

    I was wondering if you ever considered changing
    the structure of your website? Its very well written; I love what youve got to say.
    But maybe you could a little more in the way of content
    so people could connect with it better. Youve got an awful lot of
    text for only having one or 2 images. Maybe you could space it out better?

    Also visit my homepage: 918kaya kiosk

  31. Write more, thats all I have to say. Literally, it seems as though
    you relied on the video to make your point. You clearly know what youre talking about,
    why waste your intelligence on just posting videos to your
    weblog when you could be giving us something enlightening to read?

  32. www.epicwin77.com

    Unquestionably believe that which you stated. Your favorite
    reason appeared to be on the internet the easiest thing to be
    aware of. I say to you, I certainly get annoyed while people think about worries that they plainly do
    not know about. You managed to hit the nail upon the top and defined
    out the whole thing without having side-effects , people could take a signal.
    Will likely be back to get more. Thanks

  33. Just want to say your article is as amazing.
    The clearness for your put up is simply excellent
    and that i could think you are a professional on this subject.
    Well with your permission allow me to seize your RSS feed to
    keep updated with imminent post. Thank you a million and please
    carry on the gratifying work.

  34. find more

    This is really interesting, You are a very skilled blogger.

    I’ve joined your feed and look forward to seeking more of your wonderful post.
    Also, I’ve shared your website in my social networks!

  35. screenplay.press

    Have you ever thought about including a little bit more than just your articles?
    I mean, what you say is valuable and everything. But imagine
    if you added some great images or video clips to give your posts more, “pop”!
    Your content is excellent but with images and video clips, this blog could definitely be one
    of the most beneficial in its niche. Amazing
    blog!

  36. www.pdelite.org

    Hello there! I know this is kinda off topic nevertheless I’d figured I’d ask.

    Would you be interested in trading links or maybe
    guest writing a blog post or vice-versa? My website addresses a lot of the same topics as yours and I think we could greatly benefit
    from each other. If you’re interested feel free to send me
    an e-mail. I look forward to hearing from you!
    Excellent blog by the way!

  37. my link

    Nice weblog right here! Also your website lots up fast!
    What web host are you the use of? Can I get your affiliate
    hyperlink on your host? I want my web site loaded up as fast as yours lol

  38. Have you ever thought about adding a little bit more than just your articles?
    I mean, what you say is fundamental and everything. But just imagine if you added some great graphics or video clips to give your posts more, “pop”!
    Your content is excellent but with images and video clips,
    this blog could definitely be one of the greatest in its field.
    Great blog!

  39. smfpt2.smfpt.net

    If you are going for finest contents like me, just go to see this site
    daily because it offers feature contents, thanks

  40. Pretty component to content. I just stumbled upon your weblog and in accession capital to claim that I acquire in fact enjoyed
    account your weblog posts. Anyway I’ll be subscribing for your augment and even I success you get admission to consistently rapidly.

    Also visit my webpage 918kaya download apk

  41. Hey there! Quick question that’s entirely off topic.
    Do you know how to make your site mobile friendly? My site
    looks weird when browsing from my iphone 4. I’m trying to find a template or
    plugin that might be able to correct this problem.
    If you have any suggestions, please share. Many thanks!

    Also visit my page :: pussy888 download – archives.bia.or.th

  42. Great goods from you, man. I’ve understand your stuff previous
    to and you’re just extremely fantastic. I really like what you’ve acquired here, certainly like
    what you’re saying and the way in which you say it. You make
    it enjoyable and you still care for to keep it smart.
    I can’t wait to read far more from you. This is actually a
    tremendous site.

  43. freeholmes.com

    I have to thank you for the efforts you’ve put in writing this website.
    I’m hoping to check out the same high-grade blog posts from
    you later on as well. In truth, your creative writing abilities
    has inspired me to get my very own blog now 😉

    Here is my web-site freeholmes.com

  44. try this web-site

    Amazing! This blog looks exactly like my old one! It’s on a totally different subject but it has pretty much
    the same layout and design. Superb choice of colors!

  45. Today, while I was at work, my cousin stole my
    apple ipad and tested to see if it can survive a 25 foot drop,
    just so she can be a youtube sensation. My iPad is now broken and she has 83 views.
    I know this is completely off topic but I had to share it with
    someone!

    Feel free to visit my web page: pussy888 apk, http://wiki.trumpchannel.org,

  46. maps.google.com

    Hi, all the time i used to check web site posts here early in the daylight, for the reason that i like to find out more and more.

  47. Great write-up, I’m regular visitor of one’s blog, maintain up the nice operate, and It is
    going to be a regular visitor for a long time.

    Feel free to surf to my site; http://www.hdmeg.net/

  48. troop1054.us

    It is really a nice and helpful piece of info. I am glad that you just shared this
    helpful info with us. Please keep us up to date like this.
    Thank you for sharing.

  49. persia-rp.com

    Thanks for some other informative website. The place else may I get
    that kind of info written in such a perfect manner? I
    have a challenge that I’m just now working on, and I’ve
    been on the look out for such information.

  50. site

    What a data of un-ambiguity and preserveness of precious knowledge regarding unexpected emotions.

  51. 918kaya demo id

    What’s up, this weekend is pleasant in support of me, for the reason that this point in time
    i am reading this impressive informative piece of writing here
    at my residence.

    Here is my blog post … 918kaya demo id

  52. my review here

    What’s Happening i’m new to this, I stumbled upon this I
    have discovered It positively helpful and it has helped me out
    loads. I hope to contribute & assist other customers like
    its helped me. Great job.

  53. Pretty section of content. I just stumbled upon your weblog and
    in accession capital to claim that I get in fact loved account
    your blog posts. Anyway I will be subscribing to your augment or even I fulfillment you access
    constantly fast.

  54. panther moon xe88

    Hi i am kavin, its my first time to commenting anyplace, when i read
    this post i thought i could also make comment due to this
    brilliant article.

    Also visit my web blog panther moon xe88

  55. visit here

    It’s not my first time to pay a quick visit this web page, i am browsing this web page
    dailly and get pleasant data from here everyday.

  56. game ex88

    Good day! Do you know if they make any plugins to help with Search Engine
    Optimization? I’m trying to get my blog to rank for some targeted keywords but I’m not seeing very good
    success. If you know of any please share. Many thanks!

    My web page game ex88

  57. Hmm it seems like your site ate my first comment (it was extremely long)
    so I guess I’ll just sum it up what I submitted and say, I’m thoroughly enjoying your blog.
    I too am an aspiring blog writer but I’m still new to the whole
    thing. Do you have any tips for beginner blog writers? I’d really
    appreciate it.

    Feel free to visit my web site http://siremifasol.chez.com/modules/profile/userinfo.php?uid=2162821

  58. Hey There. I found your blog using msn. This is a
    very well written article. I will be sure to bookmark it and return to read more of your useful info.
    Thanks for the post. I will certainly comeback.

  59. linked here

    My family members every time say that I am killing my time
    here at net, except I know I am getting experience daily by reading thes nice articles.

  60. cara hack 918kaya

    always i used to read smaller articles that also clear
    their motive, and that is also happening with this piece of writing which I am reading at this time.

    Feel free to surf to my web site: cara hack 918kaya

  61. scr918

    Hi there, just became alert to your blog through Google, and found that it is truly
    informative. I’m gonna watch out for brussels. I will be grateful if you continue this in future.
    Lots of people will be benefited from your writing.
    Cheers!

    my blog post: scr918

  62. i loved this

    I am sure this article has touched all the internet viewers,
    its really really nice paragraph on building up new web site.

  63. 918kaya game

    It’s a shame you don’t have a donate button! I’d
    definitely donate to this excellent blog! I suppose for now i’ll settle for book-marking and adding your RSS
    feed to my Google account. I look forward to fresh updates and will talk about this
    blog with my Facebook group. Chat soon!

    Here is my webpage: 918kaya game

  64. tips game 918kiss

    Woah! I’m really loving the template/theme
    of this site. It’s simple, yet effective. A lot of times it’s
    very hard to get that “perfect balance” between user friendliness
    and appearance. I must say that you’ve done a amazing job with this.
    In addition, the blog loads super quick for me on Firefox.
    Excellent Blog!

    Have a look at my web site; tips game 918kiss

  65. Lyn

    Good way of describing, and pleasant piece of writing
    to obtain data on the topic of my presentation topic, which
    i am going to convey in institution of higher education.

  66. Hi! Would you mind if I share your blog with my facebook group?
    There’s a lot of people that I think would really appreciate your content.

    Please let me know. Many thanks

  67. slot

    Wow! After all I got a blog from where I be able to in fact get valuable information regarding my study and knowledge.

  68. cheap cialis

    I’m really enjoying the design and layout of your
    blog. It’s a very easy on the eyes which makes it much more pleasant for me to come here
    and visit more often. Did you hire out a developer to create your theme?
    Superb work!

    1. Kumar Gourab

      thanks a lot … I have created this website by my own.. if you also planning for such a website please feel free to contact… please subscribe for more such post… contact for further query [email protected]

  69. fake jordan shoes

    Thank you for the auspicious writeup. It in fact was a amusement account it.
    Look advanced to far added agreeable from you! However,
    how can we communicate?

Leave a Reply