title: Using putchar() and getchar() to print individual characters
body: <p>I'm trying to use putchar() and getchar() to read in a string of characters from the user, and then my loop will print each character three times, print a new line, etc etc, until every character in the variable "userInput" has been printed. When I try to compile my program I receive the following errors:</p>
  
  <pre><code>warning: assignment makes pointer from integer without a cast [enabled by default]
   userInput = getchar();
             ^
  warning: comparison between pointer and integer [enabled by default]
   while(counter &lt; strlen(userInput))
                 ^
  error: array subscript is not an integer
       putchar(userInput[counter]);
                        ^
  error: array subscript is not an integer
       putchar(userInput[counter]);
                        ^
  error: array subscript is not an integer
       putchar(userInput[counter]);
                        ^
  </code></pre>
  
  <p>How can I fix these errors? I'm new to C and can't figure out what it means by the pointer cast error, and why my counter variable isn't working.</p>
  
  <p>My code is as follows:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  #include &lt;ctype.h&gt;
  
  int main(void)
  {
      char *userInput;
      int *counter = 0;
  
      printf("Enter a string of characters: ");
      userInput = getchar();
  
  
      while(counter &lt; strlen(userInput))
      {
          putchar(userInput[counter]);
          putchar(userInput[counter]);
          putchar(userInput[counter]);
          printf("\n");
          counter++;
      }    
  }
  </code></pre>