Why doesn't return modify the value of a parameter to a function

前端 未结 7 1083
盖世英雄少女心
盖世英雄少女心 2020-12-22 13:57

Possible Duplicate:
How to modify content of the original variable which is passed by value?

I am building a

7条回答
  •  清酒与你
    2020-12-22 14:34

    Your basic problem is you don't understand how to get values out of a function. Change the relevant lines to:

    int FindArea(int rBase, int rHeight);  // prototype
    

    and

    int area = FindArea(rBase, rHeight);
    

    and

    int FindArea(int rBase, int rHeight)
    {
         return rBase * rHeight;
    }
    

提交回复
热议问题