Code
  class Person { string name, int age }
 
  ...
 
  main() {
      Person *pointer_1 = makePersonOne("Bob", 23);
      Person *pointer_2 = makePersonTwo("Jacky", 19);
 
      delete pointer_2;
      pointer_2 = 0;
  }
 
  Person* makePersonOne(string name, int age) {
      Person person_1(name, age);
      return &person_1;
  }
 
  Person* makePersonTwo(string name, int age) {
      Person *person_2 = new Person(name, age);
      return person_2;
  }
Stack & Heap
STACK
HEAP
Tutorial 2
Reset