title: How can I use pointers to display strings in an array?
body: <p>I am practicing using pointers.</p>
  <p>I have a pointer to an array of 3 strings: &quot;dog&quot;, &quot;cat&quot;, &quot;rat&quot;.</p>
  <p>I can print the contents using a <code>for</code> loop and using an array.</p>
  <p>However, I am having problems printing them using pointer arithmetic. I would like to increment the pointer to the next element in the array. However, all it does is print the dog letters.</p>
  <h3>Code:</h3>
  <pre><code>int main(int argc, char **argv)
  {
      char *str[3] = { &quot;DOG&quot;, &quot;CAT&quot;, &quot;RAT&quot;};
      int i = 0;
  
      /* display using an array element */
      for(i = 0; i &lt; 3; i++)
      {
      printf(&quot;str: %s\n&quot;, str[i]);
      }
  
      /* display using a pointer arthimatic */
      while((*str)++)
      {
      printf(&quot;str: %s\n&quot;, str);
      }
  
      getchar();
  
      return 0;
  }
  </code></pre>
  <p>How can I accomplish this?</p>
  <p>Edit:</p>
  <h3>Code:</h3>
  <pre><code>while(str)
  {
      printf(&quot;str: %s\n&quot;, *(str++));
  }
  </code></pre>
  <p>However, I get this error message. Doesn't the I-value have to be a variable of some sort?</p>
  <p>error C2105: '++' needs l-value</p>