title: c strcat with pointer
body: <p>I'm trying to use pointers and strcat from C. This is part of my learning process.</p>
  
  <p>The idea is the user inputs a string that contains digits and the output should return only the digits.
  So, if the user inputs
  <code>te12abc</code> the output should be <code>12</code>.</p>
  
  <p>This is my first try:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;string.h&gt;
  #include &lt;ctype.h&gt;
  
  #define SIZE 10
  
  int main()
  {
      char palavra[SIZE];
      char palavra2[SIZE];
      char *pont = palavra;
      char *pont2 = palavra2;
  
      printf("Insert the string\n");
      scanf("%s", palavra);
  
      do{
          if (isdigit(*pont)){
              strcat(palavra2, *pont);
          }
          *pont++;
      }while (*pont != '\0');
  
      printf("\nThe number is:\n%s\n", palavra2);
      return 0;
  }
  </code></pre>
  
  <p>I believe that the pointer is working as expected but can't understand why strcat is not working.</p>
  
  <p>Made a second try that is the program finds a number, stores that char in one variable and only then try to use strcat with that variable. Here is the code:</p>
  
  <pre><code>int main()
  {
      char palavra[SIZE];
      char palavra2[SIZE];
      char temp;
      char *pont = palavra;
      char * pont2 = &amp;temp;
  
      printf("Insert the string\n");
      scanf("%s", palavra);
  
      do{
          if (isdigit(*pont)){
              temp = *pont;
              strcat(palavra2, pont2);
          }
          *pont++;
      }while (*pont != '\0');
  
      printf("\nThe number is:\n%s\n", palavra2);
      return 0;
  }
  </code></pre>
  
  <p>Once again it gives me problems at strcat.</p>
  
  <p>Made one last attempt but without pointer and still strcat does not work. Here is the code:</p>
  
  <pre><code>int main()
  {
      int i = 0;
      char palavra[SIZE];
      char palavra2[SIZE];
      char temp;
  
      printf("Insert the string\n");
      scanf("%s", palavra);
  
      do{
          if (isdigit(palavra[i])){
              temp = palavra[i];
              strcat(palavra2, palavra[i]);
          }
          i++;
      }while (palavra[i] != '\0');
  
      printf("\nThe number is:\n%s\n", palavra2);
      return 0;
  }
  </code></pre>
  
  <p>Can you point me to the right direction? Don't now what more can I do..</p>
  
  <p>Regards,</p>
  
  <p>favolas</p>