/ Published in: C++
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
#include<iostream> using namespace std; struct auto{ int serial, godina; char proizvodac[50], model[50]; }; typedef auto element; struct el{ element value; struct el *next; }; typedef struct el stog; element TopS(stog *s){ stog *top; if(s->next==NULL){ cout<<" Greska! "<<endl; exit(1); }; top=s->next; return top->value; }; void PushS(element z, stog *s){ stog *novi; novi=(stog *)malloc(sizeof(stog)); novi->value=z; novi->next=s->next; s->next=novi; }; void PopS(stog *s){ stog *temp; if(s->next==NULL){ cout<<" Greska! "<<endl; exit(1); }; temp=s->next; s->next=temp->next; free(temp); }; stog * InitS(void){ stog *s; s=(stog *)malloc(sizeof(stog)); s->next=NULL; return s; }; int IsEmptyS(stog *s){ if(s->next==NULL) return 1; else return 0; };