Advertisement
Guest User

Untitled

a guest
Sep 21st, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.36 KB | None | 0 0
  1. #include "stack.h"
  2. #include <stdio.h>
  3.  
  4. int main() {
  5.     stack s;
  6.     int a = 4;
  7.     int b = 3;
  8.     int c = 2;
  9.     push(&s, &c);
  10.     push(&s, &a); //addr of since we're using a void pointer
  11.     push(&s, &b);
  12.     printf("%d\n", *((int*)pop(&s)));
  13.     printf("%d\n", *((int*)pop(&s)));
  14.     push(&s, &c);
  15.     printf("%d\n", *((int*)pop(&s)));
  16.     printf("%d\n", *((int*)pop(&s)));
  17.     return 0;
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement