title: Reverse an input character string
body: <p>I would like to reverse an input character string and I use the the pointer which points to the last character and make it print the string while the pointer address decreases. However, I could not get the whole string. Could anyone tell me what is wrong?</p>
  
  <pre><code>//Reverse a charater string
  #include&lt;stdio.h&gt;
  int main()
  {
    char a[50];
    int l;
    int *p;
    printf("Please input a character string:\n");
    scanf("%s",a);
    l = strlen(a);
    for (p = &amp;a[l-1]; p &gt;= a; p--)
     {
       printf("%c",*p);
      }
    printf("\n");
    return 0;
  }
  
  Output:
  Please input a character string:
  asdfasdfasdf
  fff
  </code></pre>