Home Segments Index Top Previous Next

609: Mainline

Finally, your program must examine the characters as encountered. Accordingly, you write a switch statement in which appropriately named variables are assigned:

switch (argument_array [argument_counter][string_counter]) { 
  case 'p': mean_price_switch = 1; break; 
  case 'n': mean_size_switch = 1; break; 
  default: printf ("%c is not a recognized flag.\n",  
                    argument_array [argument_counter][string_counter]); 
           break; 
} 

The %c print specification causes a character to be inserted into the displayed string.