Arrays are data structures that allow storage of and random access to multiple elements
To access a given element, use its index number, starting from 0.
The string type, for example, is simply an array of character values.
The word data, placed into a string variable called word, is an array which looks like this:
To access the t, for instance, you can use word[2]
A stack allows data to be inserted and removed at only one end, called the top.
To manage data in stacks, the following functions are generally needed:
Unlike arrays, stacks do not allow random access to data. Stacks are a last in, first out (LIFO) data structure.
To put the word data into a stack, the following operations must be preformed:
Once the data is in the stack, in order to access a given letter, you must continue to pop elements off the stack until the stack's top is equal to your target letter.
After each push or pop, you can use peek to check the current value of top
Feel free to enter various strings, which will be reversed using array iteration and stack push and pop methods
Host Console