title: Does this type of memory get allocated on the heap or the stack?
body: <p>In the context of C++ (not that it matters):</p>
  
  <pre><code>class Foo{
      private:
          int x[100];
      public:
          Foo();
  }
  </code></pre>
  
  <p>What I've learnt tells me that if you create an instance of Foo like so:</p>
  
  <pre><code>Foo bar = new Foo();
  </code></pre>
  
  <p>Then the array x is allocated on the heap, but if you created an instance of Foo like so:</p>
  
  <pre><code>Foo bar;
  </code></pre>
  
  <p>Then it's created on the stack.</p>
  
  <p>I can't find resources online to confirm this.</p>