The problem with the display_industry_name
approach is that some of
the displaying is done inside a subfunction, and some is done with an
explicit display statement. A more transparent, orthodox approach is to
have a different function, industry_name
, return a string, with all
the displaying done in the explicit display statement:
/* Display report */ for (counter = 0; counter < limit; ++counter) printf ("%s %f %i %f\n", industry_name(trade_pointers[counter]), trade_pointers[counter] -> price, trade_pointers[counter] -> number, trade_price(trade_pointers[counter]));