C++ Stacks Problem

How do I create a stack of type "char" with 100 elements?
 
char arr[100];

Any questions about this?
I hate myself for not figuring that out. Thank you zapshe.
Last edited on
Just to be clear... that is not a "stack" in the sense of the classic data structure. That's just a regular array (but certainly could be used as a stack).

C++ has a stack class built-in.
http://www.cplusplus.com/reference/stack/stack/

See an example of pushing 5 elements to the stack below.
http://www.cplusplus.com/reference/stack/stack/push/
Last edited on
I assume he meant stack as in how the memory for the char would be handled. The way char arr = new char[100] would allocate to the heap.
Topic archived. No new replies allowed.