title: new operator + default constructor in c++
body: <p>The question is already discussed here
  [a link] <a href="https://stackoverflow.com/questions/3575458/does-new-call-default-constructor-in-c">Does new[] call default constructor in C++?</a></p>
  
  <p>Being a beginner and a self-learner, will appreciate positive comments kindly pls don't generalize it as broad,narrow and etc</p>
  
  <p>When we use new[] each element is initialized by the default constructor except when the type is a built-in type. Built-in types are left unitialized by default.</p>
  
  <p>Here it is said that the objects are initialized by the default constructor what does it mean?
  Is it like every object has now key initialized to zero(by the default constructor) because that is true when I printed p[2].key?</p>
  
  <p>How can i check if the default constructor initializes an array or not being an int array it can't access the member key in main?</p>
  
  <p>Also (i) prints garbage value but (ii) prints 0;</p>
  
  <pre><code>class People
  {
      public:
        int key;
      People()
      {
          key=0;
      }
  };
  
  int main()
  {
     int count=5;
     People *p=new People[count];
     cout&lt;&lt; p[2].key;
  
     // int *arr=new int[count]; ...(i)
     //cout&lt;&lt;*(arr+2);
  
    //int *arr=new int[count](); ... (ii)
   //cout&lt;&lt;*(arr+2)&lt;&lt;endl;
  
   return 0;
  }
  </code></pre>