title: Print Implementation fails right after pushback (vector)
body: <p>I am new to C++ and vectors and so, I am facing some trouble with this function not printing the desired values after a push back. I am receiving what I believe to be garbage values. Could it be because I am working with unsigned char and not integer types? I don't know. I need to get it to work for my school assignment that is to be due soon and I am really stuck on this. Could anyone here be able to resolve this problem? Thanks!</p>
  
  <p>Desired Output:</p>
  
  <pre><code>********** TestSubscript1 **********
  Construct from unsigned char array:
  2  4  6  6  8  10  6  12  234  14  16  6  6  (size=13, capacity=16)
  </code></pre>
  
  <p>My Output:</p>
  
  <pre><code>********** TestSubscript1 **********
  Construct from unsigned char array:
  
    ê     (size=13 capacity=16)
  </code></pre>
  
  <p>Header file(My implementation):</p>
  
  <pre><code>template &lt;typename T&gt;
  vec 
  {
  
  private:
  T* v;
  int count;
  int capacity;
  public:
  
  vector(){
      capacity=0;
      v = nullptr;
      count = 0;
  }
  void push_back(const T&amp; t)
  {
      if(count+1&gt;capacity)
  {
      capacity = std::max(2*capacity, 1);
  
      T* newData = new T[capacity];
      for(int i=0; i &lt;count; i++)
      {
          newData[i] = v[i];
      }
      delete[] v;
      v = newData;
  }
  v[count++] = t;
  }
  T&amp; operator[](size_t num) const
  {   
      return v[num];
  }
  
  template &lt;typename T1&gt;
  
  friend void Print(const vector&lt;T1&gt;&amp; s);
  
  };
  template &lt;typename T1&gt;
  void Print(const vector&lt;T1&gt;&amp; s)
  {
      for(int i = 0; i &lt; s.count; i++) 
      {
      std::cout&lt;&lt;s.v[i]&lt;&lt;" ";
      }
      std::cout&lt;&lt; "(size=" &lt;&lt; s.count &lt;&lt; " " &lt;&lt; "capacity=" &lt;&lt; s.capacity &lt;&lt; 
   ")";
      std::cout&lt;&lt;std::endl; 
      }
  </code></pre>
  
  <p>main file(Remains unchanged):</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;cstdlib&gt;              // atoi
  #include "cs150_vect.h"
  
  void TestSubscript1(void)
  {
  std::cout &lt;&lt; "\n********** TestSubscript1 **********\n";
  unsigned char ia[] = { 2, 4, 6, 6, 8, 10,
                         6, 12, 234, 14, 16, 6, 6
                       };
  int size = sizeof(ia) / sizeof(*ia);
  std::cout &lt;&lt; "Construct from unsigned char array:\n";
  cs150::vector&lt;unsigned char&gt; temp_vec;
  for(int i=0; i&lt;size; ++i)
      temp_vec.push_back(ia[i]);
  
  const cs150::vector&lt;unsigned char&gt; a(temp_vec);
  Print(a);
  }
  </code></pre>