title: C function to capitalize the first character of a pointer string
body: <p>I want to capitalize the first character of a pointer string.</p>
  
  <p>For example, input: john 
  Output: John</p>
  
  <p>I can do it with arrays <code>(s[0] = toUpper(s[0])</code>, but is there a way to do it with pointers?</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;ctype.h&gt;
  #define MAX 30
  
  int transform(char *s)
  
  {
      while (*s != '\0')
      {
          *s = toupper(*s); 
          s++;
      }
  
      return *s;
  }
  
  int main()
  {
      printf("String: ");
      char *s[MAX];
  
  
      getline(&amp;s,MAX);
  
      transform(s);
      printf("Transformed char: %s", &amp;s);
  
  }
  
  int getline(char *s, int lim) 
  {
      int c;
      char *t=s;
      while (--lim&gt;0 &amp;&amp; (c=getchar())!=EOF &amp;&amp; c!='\n') *s++=c;
      *s='\0';
      while (c!=EOF &amp;&amp; c!='\n')
          c=getchar();
      return s-t;
  }
  </code></pre>
  
  <p>This code turns the whole string to upper case. </p>