Home Segments Index Top Previous Next

674: Mainline

The appropriate improvement to the check_owner function is to convert the parameter to call by reference:

// Improved; cannot contribute to excessive-reclamation bug: 
int check_owner (railroad_car& r, char *s) { 
  if (strncmp (s, r.serial_number, 3)) 
    return 0; 
  else 
    return 1; 
}