List of all available Websheets
Viewing cpp/dynamic_mem/examples/return_stack by redekopp@usc.edu. You have unsaved changes. Log in above to create, edit, preview and publish Websheets.
Property | Value |
---|---|
Description html markup shown to student | Accessing deleted stack memory. |
Public permissions | |
Remarks Comments, history, license, etc. | for this to work, either you need clang, or a recent enough version of g++ that supports -Wno-return-local-addr |
Engine | |
Template / Reference solution |
using namespace std; int* get_pointer_to(int x) { int temp = x; return &temp; } int main() { \[ \show: int* p5 = get_pointer_to(5); int* p11 = get_pointer_to(11); cout << *p5 << endl; ]\ } |
C++ test suite json list of stdin/args tests e.g. [{"stdin":"hi", "args":["4", "5"]}, {"stdin":"noargs"}] to just run once with no input use [{}] | [ {} ] |
Solution visibility | |
Is example? i.e., just a demo | |
Add compiler flag(s) json list of flags e.g. ["-Wno-unused-variable"] | ["-Wno-return-stack-address", "-Wno-unused-variable"] |
Note: problems are open-source by default (see 'Public permissions'). Assumed license for open problems is Creative Commons 4.0 Attribution-ShareAlike unless specified in 'Remarks'.