PUSH Program in Data Structure
PUSH:
#define N 10 // Maximum elements in a stack
int top = -1 // indicates empty stack
int s[N] // initially all the element are (-1)
void PUSH()
{
if (top == N)
{
printf("Stack is Full");
exit (0);
}
top = top+1;
printf("Enter any number");
scanf("%d",&item);
s[top] = item;
}
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment