title: C pointer to character array
body: <h2>I would like to pass a character pointer ( to an array) to a function which will print the letters one by one.  For example I am using the code below:</h2>
  
  <pre><code>#include&lt;stdio.h&gt;
  #include&lt;string.h&gt;
  
  void string1(char *q)
  {   
      while(*q)
      {
          printf(q++);
          printf("\n");
      }
  }
  
  main()
  {
      char name[]= "hello";
      char *p=name;
      string1(p);
  }
  </code></pre>
  
  <hr>
  
  <p>which prints: </p>
  
  <ul>
  <li>hello</li>
  <li>ello</li>
  <li>llo</li>
  <li>lo</li>
  <li>o</li>
  </ul>
  
  <hr>
  
  <p>But I want it to print; </p>
  
  <ul>
  <li>h</li>
  <li>e</li>
  <li>l</li>
  <li>l</li>
  <li>o  </li>
  </ul>
  
  <hr>
  
  <p>I am unable to do it by using the variable q inside printf. Thanks</p>