title: Digit Frequency Program (HackerRank)
body: <p>I'm trying to compare each character of the given string with numbers 0 to 9, and on successful comparison, increment the count variable. Finally, printing the value of count variable for each of the numbers.
  But these method isn't working out. Can't figure out why.</p>
  
  <pre><code>int main() {
  
      char *s;
      s = malloc(1024 * sizeof(char));
      scanf("%[^\n]", s);
  
      int i,j,count=0;
      for(i=0;i&lt;=9;i++)
      {   
          for(j=0;j&lt;strlen(s);j++)
          {
              if(s[j]==i)
              {
                  count++;
              }
          }
      printf("%d ",count);
      }   
      return 0;
  }
  </code></pre>