Featured Post

Step Wise Project Planning

Planning is the most difficult process in project management. The framework described is called the Stepwise method to help to distinguis...

  1. Home

Write a program of array implementation of a stack

Write a program of array implementation of a stack

#include<stdio.h>
#include<conio.h>
void push(int);
int pop();
int stack[10];
int top=-1,a;
void push(int num)
{
if  (top>=10)
{
printf("stack is full");
return;
}else{
top++;
stack[top]= num;
return;
}}
int pop()
{
Int num;
if (top<0)
{
printf("stack is empty");
return -1;
}
else{
num=stack[top];
top--;
return num;
}}
void main()
{
scanf("%d",&a);
push(a);
printf("The value of pop is:%d",pop());}


Output


Previous
Next Post »