Page 164 - DCAP201_FUNDAMENTALS_OF_DATA_STRUCTURES
P. 164

Unit 9: Stacks




                                                                                                Notes
                             push(&ptr,val);
                             break;
                         case 2:
                             element = pop(&ptr);
                             printf("nThe element popped from stack is :
             %d",element);
                             break;
                         case 3:
                             printf("nThe current stack elements are:");
                             display(&ptr);
                             break;
                         case 4:
                             exit(0);
                         default:
                             printf("nEnter correct option!Try again.");
                     }
                 }
             return(0);
             }



             Output:






























             Question
             Write a C program to implement evaluation of Postfix expression using Stack.
          Source: http://www.c4learn.com/c-programs/c-program-to-perform-stack-operations-using-
          pointer.html




                                           LOVELY PROFESSIONAL UNIVERSITY                                   157
   159   160   161   162   163   164   165   166   167   168   169