My last C++ class test had a question which read "Write an example of using memory on the stack" or something along those lines. I didn't know any way to use the stack other than passing function parameters and return values. I explained this in writing and got credit, but I'm still wondering how the question was meant to be answered. Are local variables (default or with the auto keyword) stored on the stack? If not, are there variable types that are stored on the stack?
Thanks!
Yes local variables (aka automatic variables that disappear when they fall out of scope) are stored on the stack, along with function parameters and return values.