37.3k views
5 votes
If you were to write a function for displaying the cost of an item to the screen, which function prototype would be most appropriate?

A) float display( void ) ;
B) void display( void );
C) void display(float my Cost);
D) int display (float my Cost);"

1 Answer

4 votes

Final answer:

The most appropriate function prototype for displaying the cost of an item to the screen is option C) void display(float myCost), which takes the cost as an argument and does not return a value.

Step-by-step explanation:

If you were to write a function for displaying the cost of an item to the screen, considering that the function's sole purpose is to display information and should not return any value, the most appropriate function prototype would be C) void display(float myCost). This is because this function prototype indicates that the function will not return any value (hence the void return type) and it takes one argument, myCost, which is the cost of the item that needs to be displayed.

User Fpiette
by
8.1k points