how to impliment 2 or more stacks in a single dimensional
array ?



how to impliment 2 or more stacks in a single dimensional array ?..

Answer / sakthigurunathan

to implement two stacks in a single array consider two
stacks growing towards each other and take tos1=-1
andtos2=max as empty condition and for full condition take
tos1=tos2-1 and to insert take push1 tos1++
and for push2 tos--

Is This Answer Correct ?    36 Yes 9 No

Post New Answer

More C Interview Questions

two progs are given. one starts counting frm 0 to MAX and the other stars frm MAX to 0. which one executes fast.

5 Answers   Verifone,


The operation of a stair case switch best explains the a) or operation b) and operation c)exclusive nor operation d)exclusive or operation Which of the following is/are syntactically correct? a) for(); b) for(;); c) for(,); d) for(;;);

1 Answers   HCL, Public Service Commission,


Program to find largest of three numbers without using comparsion operator?

3 Answers  


macros and function are related in what aspect? a)recursion b)varying no of arguments c)hypochecking d)type declaration

12 Answers   HCL, Infosys, Microsoft,


Is there anything like an ifdef for typedefs?

0 Answers  






multiple of 9 without useing +,* oprator

3 Answers  


main() { int i = 1; int num[] = {1,2,3,4}; num[i] = i++; printf("%d", num[i]); } what will be the output? }

22 Answers   NDS, TCS,


What are header files? What are their uses?

0 Answers  


What Is The Difference Between Null And Void Pointer?

0 Answers   TCS,


a C prog to swap 2 no.s without using variables just an array?

5 Answers   TCS,


What is the difference between char array and char pointer?

0 Answers  


Explain About fork()?

0 Answers   TISL,


Categories