title: Anagram of a string using pointer arithmatic
body: <p>Here is the code to find the anagram for a string. I am using pointer array to do it but want to do it using pointer arithmetic.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int check_anagram(char [], char []); 
  
  int main()
  {
      char a[100], b[100];
      int flag;
  
      printf("Enter first string\n");
      gets(a);
  
      printf("Enter second string\n");
      gets(b);
  
      flag = check_anagram(a, b);
  
      if (flag == 1)
          printf("\"%s\" and \"%s\" are anagrams.\n", a, b);
      else
          printf("\"%s\" and \"%s\" are not anagrams.\n", a, b);
  
      return 0;
  }
  
  int check_anagram(char a[], char b[])
  {
      int first[26] = {0}, second[26] = {0}, c = 0;
  
      while (a[c] != '\0')
      {
         first[a[c]-'a']++;
         c++;
      }
  
      c = 0;
  
      while (b[c] != '\0')
      {
         second[b[c]-'a']++;
         c++;
      }
  
      for (c = 0; c &lt; 26; c++)
      {
         if (first[c] != second[c])
            return 0;
      }
  
      return 1;
  }
  </code></pre>
  
  <p>--> How to using pointer arithmetic and find it.</p>
  
  <p>In the while loop :</p>
  
  <pre><code>while (a[c] != '\0')
  {
     first[a[c]-'a']++;
     c++;
  }
  </code></pre>
  
  <p>--> Can we modify it to below way so that it will work</p>
  
  <pre><code>while(*(a+c)!='\0')
  {
     *(first *(a+c)-'a')++;  
      c++;
  }
  </code></pre>