All pastes #947182 Raw Edit

Untitled

public text v1 · immutable
·published 2008-03-18 08:09 UTC
rendered paste body
#include <stdio.h>

/* Print histogram of number of chars for each word virtically...*/

int main (void)
{
     int c, i=0, numbchars =0;
     int oldword [256]; /* Only 256 lettres max so probably easy to break...*/

     /* Set all 256 indexes of the array "oldword" to 0*/
     for (oldword [i] =0; i <=255; i++)
          oldword [i] =0;

     i = 0;

     while ((c = getchar ()) !=EOF)
          {
          if ( c != ' ' || c != '\n' || c != '\t')
               {
               ++numbchars;
               oldword [i] =c;
               i++;
               }
                         else
                                        printf ("%c has %d characters\n", oldword, numbchars);
          }
          return 0;
}