C a Day 3: A Histogram of Digits

Using a combination of if, else if, else allows for filtering out characters under different test scenarios. This program starts similar to the others by including the standard library and defining the variables to hold each type of character counter and initializing them to zero.

int c, i, nwhite, nother;
nwhite = nother = 0;

The counting of the digits is held in an array. Arrays can hold multiple values and are indexed starting at 0 in C. They are declared as int ndigits[10]. The array is initialized to all zeros using a for loop

for(i = 0; i 
  3 int main(void) {
  4     int c, i, nwhite, nother;
  5     int ndigits[10];
  7     nwhite = nother = 0;
  9     for(i = 0; i = '0' && c