title: Using traversal by pointers on const array
body: <p>I'm trying to loop through a constant array of integers using pointers. My code is as follows:</p>
  
  <pre><code>void printArrayPointer(const int arr[], int n){
      for (int *i = arr; i &lt; arr + n; i++) {
          cout &lt;&lt; *i &lt;&lt; ' ';
      }
  }
  </code></pre>
  
  <p>This gives me an error telling me that there is an invalid conversion from const int* to int*. I know how to do this using traversal by index (as in using the index of the elements in the array) but I'm trying to use pointers for this code.</p>