Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int top = -1;
- int blad = 0;
- struct stos{
- int array[100];
- int next;
- };
- int STACK_EMPTY(){
- if(top==0)
- return -1;
- else
- return 1;
- }
- void PUSH(struct stos *S,int x){
- scanf("%d",&x);
- top = top +1;
- S->array[top] = x;
- S->next = top+1;
- }
- void POP(struct stos *S,int x){
- if(STACK_EMPTY() == -1){
- blad =1;
- }else{
- top--;
- }
- }
- void END(struct stos *S){
- int i;
- for(i=0;i<S.next;i++){
- printf("%d")
- }
- }
- int main()
- {
- struct stos heap;
- PUSH(&heap,1);
- printf("%d\n",top);
- printf("%d\n",heap.next);
- printf("%d\n",heap.array[0]);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement