Obtaining the type-indicating character from the input_buffer
character array is easy. You need only to access the input_buffer
as follows:
input_buffer[4]
Good programming practice dictates that the access should be done via a
reader function, however. That way, should the railroad's numbering
convention change, you need to change only one reader function, rather than
to change a million places where you need to dig type information out of a
serial number. Suppose that you decide to call your function
extract_car_code
; then, you supply extract_car_code
with
input_buffer
as the argument, remembering that an array name is
really a constant that points to the array:
extract_car_code (input_buffer)