title: How to use pointers in for loops to count characters?
body: <p>I was looking through the forums and saw a question about counting the numbers of each letter in a string. I am teaching myself and have done some research and am now starting to do projects. Here I have printed the elements of the array. But I do so without pointers. I know I can use a pointer to an array and have it increment for each value, but I need some help doing so. </p>
  
  <p>Here is my code without the pointer:</p>
  
  <pre><code>code main() {
      char alph [] = {'a', 'b', 'c'};
      int i, o;
      o = 0;
      for(i=0; i &lt; 3; i++)
          { cout &lt;&lt; alph[i] &lt;&lt; ' '; };
  };
  </code></pre>
  
  <p>Here is my bad code that doesn't work trying to get the pointer to work. </p>
  
  <pre><code>main() {
      char alph [] = {'a', 'b', 'c'};
      char *p;
      p = alph;
  
      for (; p&lt;=3; p++);
          cout &lt;&lt; *p;
  
      return 0;
  };
  </code></pre>
  
  <p>I hope that it's not too obvious of an answer; I don't mean to waste anyone's time. Also this is my first post so if anyone wants to give me advice, thank you. </p>