EmbLogic's Blog

what’s wrong wid da code??????

#include<stdio.h>
int sarr[7];
int i,j=200;top=-1;
int push();
int pop();
int display();
int ch;
int main()
{
while(j>1)
{
printf(“enter case\n”);
scanf(“%d”,&ch);
switch(ch)
{
case 0:push();
break;
case 1:pop();
break;
case 3:j=-1;
break;
default:
printf(“wrong selection”);
}
}
}
int push()

{
if(top>7)
{
printf(“overflow”);
}
else
{
printf(“enter value”);
top++;
scanf(“%d”,&sarr[top]);
display();
}

int pop()
{
if(top<0)
{
printf(“underflow\n”);
}
else
{
top–;
display();
}
}

int display()
{
int i;
for(i=top;i>0;i–)
{
printf(“values are%d”,sarr[i]);
}

}
}
 

2 Responses to what’s wrong wid da code??????

  1. vaibhavSingh says:

    What type of Error you are getting from this code in your Output ??

Leave a Reply to vaibhavSingh Cancel reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>