Looking for a Tutor Near You?

Post Learning Requirement »
x

Choose Country Code

x

Direction

x

Ask a Question

x

x
x
x
Hire a Tutor

Data Structure

Loading...

Published in: C / C++
760 Views

C Programmings of Data Structure with output.

Sayantan A / Kolkata

8 years of teaching experience

Qualification: M.Tech

Teaches: Chemistry, Computer Science, Mathematics, Physics, GATE Exam, JEXPO, MCA Entrance Exam (JECA), Polytechnic Entrance, Computer, IT

Contact this Tutor
  1. Q.NO - 8 : MENU DRIVEN PROGRAM TO IMPLEMENT STACK USING ARRAY #include #include int stack[l O]; int top = -1; void push(int item) if (top printf("OverfIow\n"); exit(l ); stack[++top] = item; int pop() if (top printf("UnderfIow\n"); exit(2); POPPED ELEMENT void display() int i=top; if (top printf("UnderfIow\n"); exit(2); STACK •S AS FOLLOWS\n"); int main(void) int
  2. int i, n; push(10); push(15); do a IN STACK FROM STACK\n"); switch(choice) case 1: case 2: DATA TO BE PUSHED\n"); scanf("%d",&num); push(num); break; POP(); break; case 3: display(); break; printf("Do you wish to continue press l\n"); return O; OUTPUT 1 : Enter a choice I:PUSH IN STACK 2:POP FROM STACK 3:DlSPLAY 1 ENTER DATA TO BE PUSHED 35 Do you wish to continue press 1 1 Enter a choice I:PUSH IN STACK 2:POP FROM STACK 3:DlSPLAY 1 ENTER DATA TO BE PUSHED
  3. 45 Do you wish to continue press 1 1 Enter a choice I:PUSH IN STACK 2:POP FROM STACK 3:DlSPLAY 1 ENTER DATA TO BE PUSHED 55 Do you wish to continue press 1 1 Enter a choice I:PUSH IN STACK 2:POP FROM STACK 3:DlSPLAY 3 THE STACK •S AS FOLLOWS 55 45 35 15 10 Do you wish to continue press 1 1 Enter a choice I:PUSH IN STACK 2:POP FROM STACK 3:DlSPLAY 2 THE POPPED ELEMENT WAS 55 Do you wish to continue press 1 1 Enter a choice I:PUSH IN STACK 2:POP FROM STACK 3:DlSPLAY 2 THE POPPED ELEMENT WAS 45 Do you wish to continue press 1 1 Enter a choice I:PUSH IN STACK 2:POP FROM STACK 3:DlSPLAY 3 THE STACK •S AS FOLLOWS
  4. 35 15 10 Do you wish to continue press 1 OUTPUT 2 : Enter a choice I:PUSH IN STACK 2:POP FROM STACK 3:DlSPLAY 1 ENTER DATA TO BE PUSHED 11 Do you wish to continue press 1 1 Enter a choice I:PUSH IN STACK 2:POP FROM STACK 3:DlSPLAY 1 ENTER DATA TO BE PUSHED 21 Do you wish to continue press 1 1 Enter a choice I:PUSH IN STACK 2:POP FROM STACK 3:DlSPLAY 1 ENTER DATA TO BE PUSHED 31 Do you wish to continue press 1 1 Enter a choice I:PUSH IN STACK 2:POP FROM STACK 3:DlSPLAY 3 THE STACK •S AS FOLLOWS 31 21 11 15 10
  5. Do you wish to continue press 1 1 Enter a choice I:PUSH IN STACK 2:POP FROM STACK 3:DlSPLAY 2 THE POPPED ELEMENT WAS 31 Do you wish to continue press 1 1 Enter a choice I:PUSH IN STACK 2:POP FROM STACK 3:DlSPLAY 2 THE POPPED ELEMENT WAS 21 Do you wish to continue press 1 1 Enter a choice I:PUSH IN STACK 2:POP FROM STACK 3:DlSPLAY 3 THE STACK •S AS FOLLOWS 11 15 10 Do you wish to continue press 1