Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat does it mean to return a function result as an "output parameter"?
    primarykey
    data
    text
    <p>Hi I was hoping that I could get a better understanding of a few things regarding C++. We are learning about functions and I missed a class and I'm thinking it was the wrong class to of missed because I am so confused. I have two problems regarding clear and concise direction and understanding of terms. This was my first one:</p> <p>a) Write a C++ function named "product" that calculates the product of two integer values passed to it as. The function will takes two input arguments and return the computed answer as an output parameter of the function. b) Write a single line of code that might be used to call(invoke) this function.</p> <p>This is the second one: a) Write a C++ function named "product" that calculates the product of two integer values passed to it as. The function will takes two input arguments and returns the product answer as the result of the execution of the function. b) Write a single line of code that might be used to call(invoke) this function.</p> <p>So my guess is that the second one is meant to be something like this:</p> <pre><code> int product(int a, int b) { return a*b; } </code></pre> <p>and part b as cout &lt;&lt; "The product of your two numbers is " &lt;&lt; product(a,b);</p> <p>First off am I right and either way what would be meant by return answer as output parameter. And while I am at and you feel like taking pity on me could you tell me should I use void instead of int and finally can someone explain better what exactly it is to return by reference. I get the whole aspect about it needs to have an &amp; at the end of the parameter and "technically" that it allows me to change it rather than just return it but I was hoping for something a little more in depth? Sorry to be so needy but any help would be greatly appreciated. Thanks Lynda</p> <p>P.S. I would have tagged as homework but it was deprecated. Sorry!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload