title: Unitialized local variable and help correcting
body: <p>I am learning about pointers and the <code>new</code> operator in class.</p>
  
  <p>In my readArray function I am to read in a size. Use the size to <strong>dynamically</strong> create an integer array. Then assign the array to a pointer, fill it, and return the size and array.</p>
  
  <p>I believe I've gotten that part corrected and fixed but when I try to sort the array, i get the error <em>"uninitialized local variable <code>temp</code> used."</em></p>
  
  <p>The problem is though I get that error when I am trying to intialize it.
  Any help appreciated thank you. Seeing my errors is very helpful for me.</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  int* readArray(int&amp;);
  void sortArray(int *, const int * );
  
  int main ()
  {
      int size = 0;
      int *arrPTR = readArray(size);
      const int *sizePTR = &amp;size;
      sortArray(arrPTR, sizePTR);
  
      cout&lt;&lt;arrPTR[1]&lt;&lt;arrPTR[2]&lt;&lt;arrPTR[3]&lt;&lt;arrPTR[4];
  
          system("pause");
          return 0;
  }
  
  
  int* readArray(int &amp;size)
  {
      cout&lt;&lt;"Enter a number for size of array.\n";
      cin&gt;&gt;size;
      int *arrPTR = new int[size];
  
      for(int count = 0; count &lt; (size-1); count++)
      {   
           cout&lt;&lt;"Enter positive numbers to completely fill the array.\n";
           cin&gt;&gt;*(arrPTR+count);
      }
  
      return arrPTR;
  }
  
  void sortArray(int *arrPTR, const int *sizePTR)
  {
      int *temp;
      bool *swap;
  
      do
      {
          swap = false;
          for(int count = 0; count &lt; (*sizePTR - 1); count++)
          {
              if(arrPTR[count] &gt; arrPTR[count+1])
              {
                  *temp = arrPTR[count];
                  arrPTR[count] = arrPTR[count+1];
                  arrPTR[count+1] = *temp;
                  *swap = true;
              }
          }
      }while (swap);
   }
  </code></pre>