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

/*what is the output for the code*/ void main() { int r; r=printf("naveen"); r=printf(); printf("%d",r); getch(); }

1 Answers   CDAC,


What is the difference b/w main() in C language and main() in C++.

7 Answers  


What should malloc() do? Return a null pointer or a pointer to 0 bytes?

0 Answers  


What is huge pointer in c?

0 Answers  


What is a pointer?

1 Answers   ADP, IFFCO,






Give the Output : * * * * * * * * * *

2 Answers  


what is level of tree if leaf node is at level 4.please explain.

1 Answers   Wipro,


What is the difference between constant pointer and pointer to a constant. Give examples.

4 Answers   TCS,


what is the difference between #include<stdio.h> and #include "stdio.h" ?

3 Answers  


What does printf does?

0 Answers  


#include<stdio.h> #include<conio.h> int main() { int a[4][4]={{5,7,5,9}, {4,6,3,1}, {2,9,0,6}}; int *p; int (*q)[4]; p=(int*)a; q=a; printf("\n%u%u",p,q); p++; q++; printf("\n%u%u",p,q); getch(); return 0; } what is the meaning of this program?

2 Answers  


#include show(int t,va_list ptr1) { int a,x,i; a=va_arg(ptr1,int) printf(" %d",a) } display(char) { int x; listptr; va_star(otr,s); n=va_arg(ptr,int); show(x,ptr); } main() { display("hello",4,12,13,14,44); }

0 Answers   Wilco,


Categories