{"pageProps":{"code":{"CMakeLists.txt":{"name":"CMakeLists.txt","content":"add_executable(new new.cpp)\r\n\r\nadd_executable(scope-w5 scope.cpp)\r\n","path":"code/6771/25T2/5.2/CMakeLists.txt","fileext":"txt"},"new.cpp":{"name":"new.cpp","content":"#include <iostream>\r\n#include <vector>\r\n\r\nint main() {\r\n  int* a = new int{4};\r\n  std::vector<int>* b = new std::vector<int>{1,2,3};\r\n  std::cout << *a << \"\\n\";\r\n  std::cout << (*b)[0] << \"\\n\";\r\n  delete a;\r\n  delete b;\r\n  return 0;\r\n}","path":"code/6771/25T2/5.2/new.cpp","fileext":"cpp"},"scope.cpp":{"name":"scope.cpp","content":"#include <iostream>\r\n#include <vector>\r\n\r\nint* newInt(int i) {\r\n  int* a = new int{i};\r\n  return a;\r\n}\r\n\r\nint main() {\r\n  int* myInt = newInt(5);\r\n  std::cout << *myInt << \"\\n\"; // a was defined in a scope that\r\n                           // no longer exists\r\n  delete myInt;\r\n  return 0;\r\n}","path":"code/6771/25T2/5.2/scope.cpp","fileext":"cpp"}}},"__N_SSG":true}