Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- typedef struct Node{
- int value;
- struct node * next;
- }node;
- typedef struct Stack{
- node * head;
- }stack;
- void pop(stack * st){
- node * temp = st->head;
- st->head = st->head->next;
- free(temp);
- }
- void push(stack * st,int value){
- node * temp;
- temp->value = value;
- temp->next = st->head;
- st->head = temp;
- }
- // typedef struct asd{
- // int a;
- // }Nurbek;
- int main()
- {
- stack st;
- node myNode;
- myNode.value = 1;
- st.head = &myNode;
- push(&st,2);
- printf("%d\n",st.head->value);
- node * temp = st.head;
- while(temp){
- printf("asdfosadifj\n");
- printf("%d\n",temp->value);
- temp = temp->next;
- }
- printf("Hello, World!\n");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement