p2_1_incomplete.txt - #include <math.h>#include...

This preview shows page 1 - 3 out of 3 pages.

#include <math.h> #include <stdio.h> #include <string.h> #include <stdlib.h> #include <assert.h> #include <limits.h> #include <stdbool.h> //char structure struct Node{ char data; struct Node *next; }; struct Node *newnode(char data){ struct Node* node =(struct Node*) malloc(sizeof(struct Node)); node->data=data; node->next=NULL; return node; } void push(struct Node **stack, char data){ struct Node *stacknode = newnode(data); stacknode->next = *stack; *stack=stacknode; } char empty(struct Node *stack){ return !stack; } char pull(struct Node **stack){ /*if(empty(*stack)){ return 0; }*/ //else{ struct Node *temp=*stack; *stack=(*stack)->next; char p=temp->data; free(temp); return p; //} } // integer structure struct Node_int{ int data; struct Node_int *next; }; struct Node_int *newnode_int(int data){ struct Node_int* node =(struct Node_int*) malloc(sizeof(struct Node_int)); node->data=data; node->next=NULL; return node; } void push_int(struct Node_int **stack, int data){ struct Node_int *stacknode = newnode_int(data); stacknode->next = *stack; *stack=stacknode; } int empty_int(struct Node_int *stack){ return !stack; } int pull_int(struct Node_int **stack){ /*if(empty(*stack)){ return 0; }*/ //else{ struct Node_int *temp=*stack; *stack=(*stack)->next;
Image of page 1

Subscribe to view the full document.

int p=temp->data;
Image of page 2
Image of page 3
  • Winter '17
  • R. K. Gosh
  • Void type, #include, scanf, void push, StackNode

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern