Follow Our FB Page << CircleMedia.in >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...


What do you mean by stack program?
Get me an example stack program?

Answers were Sorted based on User's Feedback



What do you mean by stack program? Get me an example stack program?..

Answer / harshita gangwar

<STACK>
stack is a linear kind of data structure .it works on "LIFO"
,LIFO stands for last in first out. in stack we perform two
operations i.e. insertion & deletion & these operations
performs only at one end i.e called "TOP".
for eg: a stack of books..etc
there are two operations performs-
(1) push (2) pop
there are also two conditions occures in case of stack i.e.
i.e. (i)underflow (ii)overflow
/*ALGO FOR PUSH OPERATION*/
PUSH( stack[],TOP,item, len)
1) set TOP=-1
2) if TOP==len-1, then
print stack is overflow.
3) else
set TOP=TOP+1
set stack[TOP]=item
4) EXIT.
In the PUSH operation the overflow condition generates.
/*ALGO FOR POP OPERATION*/
POP(stack[],TOP,item,len)
1) set TOP=len-1
2) if TOP==-1, then
print stack is underflow.
3) else
set item=stack[TOP]
set TOP=TOP-1
4) EXIT.
In the POP operation the underflow condition generates.
OTHER EGS OF STACK:-
(I)a stack of disks.
(II)a common model of a stack is plates in a party
where fresh plates are "PUSHED"(inserting) on to the TOP &
"POPED"(deleting) from the TOP.

Is This Answer Correct ?    11 Yes 0 No

What do you mean by stack program? Get me an example stack program?..

Answer / manoj singh

stac program is called whose as provide the lifo mens last input first output .when we putdown the value in node thats called pop and flow out the value thats called push.

char stack[10]
int top=-1;
void push(char d)
{
if(to==9)
printf("stack is full");
else
stack[++top]=d;
}
char pop()
{
if(top==-1)
return('\0')
else
return(stack[top--]);
}
//stack is create both performance pop and push.

Is This Answer Correct ?    8 Yes 2 No

What do you mean by stack program? Get me an example stack program?..

Answer / puneettan

A Stack can be imagined as dinner plates put one over the
another.
'Push' means-- Inserting a new value(like putting a new
dinner plate on the top of the stack)
'Pop' means-- Removing(deleting) a value from the stack(just
like we remove a plate from the top of the stack)

A Stack follows L.I.F.O(Last In First Out).. This means, the
value which was last inserted into a stack would be the
first one to be removed. In the analogous case of dinner
plates, imagine that the plate kept last, on the top of
other plates will have to be removed first. you cannot
remove a plate at the bottom directly.

<--Program, same as given in 1st answer-->
//declaring the variables
char stack[10]
int top=-1;

//making a function for 'Push' mechanism
void push(char d)
{
if(to==9)
printf("stack is full");
else
stack[++top]=d;
}

//making a function for 'Pop' mechanism
char pop()
{
if(top==-1)
return('\0')
else
return(stack[top--]);
}

Is This Answer Correct ?    3 Yes 1 No

What do you mean by stack program? Get me an example stack program?..

Answer / abcdkr

Manoj Singh
I am very sorry to say that I didn't understand the program.
I am just in eleventh standard.
please help me out line by line.
Thank YOu!

Is This Answer Correct ?    3 Yes 3 No

Post New Answer



More OOPS Interview Questions

What is encapsulation in oops?

0 Answers  


What does enum stand for?

0 Answers  


How compiler selects(internally) required overridden function in inheritance?

2 Answers   CSC, Infinite Computer Solutions,


What are virtual classes?

0 Answers  


How to overload postfix operator in c++

1 Answers   Mphasis,






What is conditional Compilation?

3 Answers   emc2, HCL,


Should you protect the global data in threads? Why or why not?

2 Answers   IBM,


What is the point of oop?

0 Answers  


How do you define social class?

0 Answers  


What is advantage of inheritance?

0 Answers  


What is multilevel inheritance in oop?

0 Answers  


What is command routing in MFC

1 Answers   GE,






Categories