IN OUT and INOUT Argument in C++ Functions

I don't understand it.
what is the difference between the input argument and the output argument and the inputoutput (3rd argument).
How can we differentiate between them and what happens when we call this function and pass three arguments?

In your function x and z are input arguments because they are passed by value. What ever the function does it can not alter the value of x and z in the calling code.

*y (note not y) could already be an in, out or inout parameter because the function can alter the value of *y in the calling code but you can tell if it actually does without seeing the function code or description.

For a parameter to be an out or inout parameter it must passed a reference to the variable in the calling code, even if it does it the old C way of passing a pointer to the variable by value.

Your best bet is to write some code and experiment a bit with the various ways of passing a parameter to a function and seeing what happens if you try to alter the parameter in the function.

Note that the terms "IN", "OUT", and "INOUT" are just a description of what the parameters are used for. Only for human consumption and mean absolutely nothing to the actual program or function. When you learned C or C++ language you did not use those terms, but you did learn the same functionality. You can normally just ignore the terms IN, OUT and INOUT and just concentrate on what the function does, what parameters to pass, and what the return value(s) is(are).

>>am i correct?
No. The function will use the parameters as described by IN, OUT or INOUT. That says how the parameters are used by the function. For example, if the parameter is INOUT then you need to set the value of the parameter then pass a pointer to it. For example the function could be something like this. Note that INOUT is in comments because there is no such c++ keyword.

You, the programmer, are responsible for writing the body of that Read() function. Apparently you told vc++ you wanted that to be a member of the ATL program you are writing (or someone else write for you).

The first parameter is a pointer to a long integer. Because it is [IN][OUT] its value must be set before passing it to Read(). The Read() function might use that for something and change its value to something else. What it does, I don't know since you didn't post the whole function.

The second parameter is a long integer passed by value because its only [IN].

The third parameter is [OUT], and looks like a buffer to hold some data results. The Read() function will most likely use it to read a file or something into that buffer.

The last parameter [RETVAL][OUT] is a BSTR which Read() will set to something. RETVAL is similar to [IN][OUT], but a function can only have one RETVAL parameter. Not sure myself why, except that's just the way it is.

Hi. so this is actually a continuation from another question of mine[Here](https://www.daniweb.com/programming/software-development/threads/506795/dynamically-add-values-into-datagridview-cell-from-listbox-vb2010) but i was advised to start a new thread as the original question …

I have a 2d matrix with dimension (3, n) called A, I want to calculate the normalization and cross product of two arrays (b,z) (see the code please) for each column (for the first column, then the second one and so on).
the function that I created to find the ...

Write a C program that should create a 10 element array of random integers (0 to 9). The program should total all of the numbers in the odd positions of the array and compare them with the total of the numbers in the even positions of the array and indicate ...