Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stddef.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- typedef struct stos_tag {
- int dane;
- struct stos_tag *nast;
- } t_stos;
- int push(t_stos *stos, int *dana)
- {
- t_stos *nowy;
- nowy= (t_stos*)malloc(sizeof(t_stos));
- if nowy == NULL
- return -1;
- nowy->dane = *dana;
- nowy->nast = stos;
- stos = nowy;
- return 0;
- }
- int pop(t_stos *stos, int *dana)
- { t_stos *wsk;
- if(stos!=NULL)
- {
- wsk=stos;
- *dana = stos-> dane;
- stos=stos->nast;
- free(wsk);
- return 0;
- }
- return -1;
- }
- int empty(t_stos *stos)
- {
- if(stos==NULL)
- return 1;
- else
- return 0;
- }
- int main()
- {
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement