Programming Question. Help!!!

Discussion in 'Embedded Systems and Microcontrollers' started by Ricky Sum, Jun 30, 2016.

  1. Ricky Sum

    Thread Starter New Member

    May 6, 2016
    Hi, I have a programming question and I have answered it but not sure was it correct. Please advise. Thank

    void ShowCost( float fltCost )

    Identify the errors in the following statements, if any, in calling the function showCost().

    A. showcost(fltTotal);

    Answer: Case sensitive, this will fail

    B. ShowCost( float fltTotal);

    Answer: When calling the function, you pass the (float) parameter, don't declare it as 'float'

    C. ShowCost();

    Answer: A (float) parameter must be passed to the function.

    D. fltPrice = ShowCost(fltTotal);

    Answer: The function does not return a value, so "fltPrice = " is wrong.

    Answer: A correct call to the function:- ShowCost(fltTotal);
  2. AlbertHall

    Well-Known Member

    Jun 4, 2014
    Hi again!
    I think you should have more confidence in your own answers :)
    absf and JWHassler like this.