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 does <> mean pseudocode?

0 Answers  


Why do we use polymorphism in oops?

0 Answers  


Have you ever interfaced with a database?

2 Answers   IBM,


What is oops concept with example?

0 Answers  


In c++ there is only virtual destructors, no constructors. Why?

4 Answers   IBM, Polaris,






what is difference between objects and function

1 Answers  


what is the advantage in software? what is the difference between the software developer and Engineer

1 Answers  


what are abstract classes and how they impliment , with example

2 Answers  


Can we create object of class with private constructor?

5 Answers  


what is the realstic modeling?

1 Answers  


what is SPL in c++.

1 Answers  


class type to basic type conversion

0 Answers  


Categories