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 abstraction?

9 Answers  


Plese get me a perfect C++ program for railway/airway reservation with all details.

0 Answers   ITM,


what is overloading

3 Answers   MindCracker,


When is a memory allocated to a class?

11 Answers  


• What are the desirable attributes for memory managment?

0 Answers  






Explain the concepts involved in Object Oriented programming.

0 Answers   Wipro,


How to reverse a sentence in c program ex: ram is a good boy answer: boy good a is ram

0 Answers   IBM,


What is Agile methodology?

20 Answers   ABC, Accenture, College School Exams Tests, Inmar, Microsoft, Sapient,


can we make game by using c

1 Answers   SmartData,


Can private class be inherited?

0 Answers  


Name a typical usage of polymorphism

3 Answers  


What is overloading in oop?

0 Answers  


Categories