DOWNLOAD PROGRAM CODING: #include<stdio.h> #include<conio.h> #include<string.h> #define max 50 char string[max]; int top=-1; void push(char a); char pop(); void main() { char str[50]; int i; clrscr(); printf("ENTER THE VALID CHARCTER STRING:"); gets(str); for(i=0;i<strlen(str);i++) push(str[i]); for(i=0;i<strlen(str);i++) str[i]=pop(); printf("REVERSED STRING..."); puts(str); getch(); } void push(char s) { if(top==(max-1)) { printf("STACK IS OVERFLOW..."); } string[++top]=s; } char pop() { if(top==-1) { printf("STACK IS UNDERFLOW..."); } return string[top--]; }
FOR BEGINNER PROGRAMMER & COMPUTER SCIENCE STUDENTS