Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- struct Node
- {
- char data;
- struct Node* link;
- };
- char a;
- int val;
- struct Node* top = NULL;
- void push()
- {
- struct Node* NewNode = (struct Node*) malloc(sizeof(struct Node));
- NewNode->data = a;
- NewNode->link = top;
- top=NewNode;
- }
- void print()
- {
- struct Node* temp = top;
- while(temp!=NULL)
- {
- printf("\n\n\n%c",temp->data);
- temp=temp->link;
- }
- printf("\n");
- }
- int main(){
- while(val=1)
- {
- scanf("%c", &a);
- push();
- print();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement