/* www.troubleshootyourself.com Program to reverse String using Stack */ #include#include /* Set maximum number of charecters */ #define MAX 100 /* Stack variables */ int top=-1; int item; /* String array variable to store string char*/ char stack_string[MAX]; /* Function to push character */ void pushChar(char item); /* Function to pop character */ char popChar(void); /* Function to check whether stack is empty or not */ int isEmpty(void); /* Function to check whwther stack is full or not */ int isFull(void); int main() { char str[MAX]; int i; /* Read any string with spaces */ printf("Enter the string to reverse: "); scanf("%[^\n]s",str); for(i=0;i Check and run the program here:
You can run the above program on codeboard editor and see the results. You are allowed to modify code and run. In the editor there is a menu at the top-right corner. Here you can see two buttons such as ‘Compile’ and ‘Run’.
We will be happy to hear your thoughts