title: Array pointers giving Garbage value while looping through it
body: <p>I am a CPP noob. Sometime (only sometime) I get garbage value for the zeroth index of the array which is passing to a display function as array pointer.
  Here is my code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  void display(int arr[], int size)
  {
      for (int i=0; i&lt;size; i++)
      {
          cout &lt;&lt; arr[i] &lt;&lt; endl;
      }
  }
  
  
  int main()
  {
      int size = 8;
      int arr [size] = {6, 3, 1, 0, 2, 9, 8, 7};
      int temp;
      int j;
  
      for (int i=0; i&lt;size; i++)
      {
          j = i+1;
          while (j!=0 &amp;&amp; arr[j] &lt; arr[j-1])
          {
              temp = arr[j-1];
              arr[j-1] = arr[j];
              arr[j] = temp;
              j--;
          }
      }
      display(arr, size);
  }
  </code></pre>
  
  <p>And here is my output of one instance. Sometime I get the proper value which makes it difficult to debug.</p>
  
  <pre><code>-1200926128
  0
  1
  2
  3
  6
  7
  8
  [Finished in 0.3s]
  </code></pre>