Not logged in. Log in with GitHub. About Websheets.

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.
PropertyValue
Description
html markup
shown to student
 
Accessing deleted stack memory.
Public permissions remove
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
remove
Engine
Template / Reference solution
 
#include <iostream>
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 remove
Is example?
i.e., just a demo
remove
Add compiler flag(s)
json list of flags
e.g. ["-Wno-unused-variable"]
 
["-Wno-return-stack-address", "-Wno-unused-variable"]
remove


Optional properties:

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'.