title: why v[0] and *v.begin() printing 0 even though i am not passing some 0 as input value for array
body: <pre><code>#include &lt;iostream&gt;
  #include &lt;vector&gt;
  using namespace std;
  
  int main()
  {
      int testcases = 0;
      int length;
      int item =0;
  
      std::vector&lt;int&gt; v;
  
      cin&gt;&gt;testcases;
      for (int i=0; i&lt;testcases; ++i)
      {
          cin&gt;&gt;length;
  
          v.resize(length);
          for (int j=0; j&lt;length; ++j)
          {
  
              cin &gt;&gt; item;
              cout &lt;&lt; "item entered:" &lt;&lt; item &lt;&lt; endl;
              v.push_back(item);
  
          }
  
          cout &lt;&lt; v[0] &lt;&lt; " ";
          cout &lt;&lt; *v.begin() &lt;&lt; " ";
  
          int loop=0;
          cin&gt;&gt;loop;
  
          int range1=0, range2=0;
  
  
          int result = 0;
          for (int k=0; k&lt;loop; ++k)
          {
              result = 0;
              cin&gt;&gt;range1;
              cin&gt;&gt;range2;
              cout &lt;&lt; v[range1]&lt;&lt; " "&lt;&lt; v[range2] &lt;&lt;endl;
              while (range1&lt;=range2)
              {
                  result = result^v[range1];
                  ++range1;
              }
              cout &lt;&lt; result &lt;&lt; endl;
          }
  
      }
  
  
      return 0;
  }
  </code></pre>
  
  <p>why v[0] and *v.begin() printing 0 even though i am not passing some 0 as input value for array </p>