Home Segments Index Top Previous Next

604: Mainline

Evidently, extract_car_code must take an argument that is a pointer to a character array, and it must return a character. Hence, the definition of extract_car_code must declare a character-pointer argument and a character return value:

char extract_car_code (char *input_buffer) {...} 

The body, of course, just needs to pick out the fourth element—the one carrying the car-type information:

char extract_car_code (char *input_buffer) { 
  return input_buffer[4]; 
}