Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #include<conio.h>
- #define max 100
- int top,stack[max];
- void push(char x){
- if(top==max-1){
- printf("stack overflow");
- } else {
- stack[++top]=x;
- }
- }
- void pop(){
- printf("%c",stack[top--]);
- }
- void main()
- {
- char str[50];
- printf("Enetr the desired string:\n");
- gets(str);
- int len = strlen(str), i;
- for(i=0; i<len; i++)
- push(str[i]);
- for(i=0; i<len; i++)
- pop();
- getch();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement