Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Just for the sake of it, let's replace <code>structure</code> with <code>char</code> (for the moment), since I think you have also some troubles with the type <code>structure</code>. Then we have a function like this:</p> <pre><code>char *readThingsFromFile(char *arrayOfThings, int &amp;arraySize) { // Some Code } </code></pre> <p>The first <code>char *</code> describes the <strong>type</strong> of the <strong>return value</strong> from your function <code>readThingsFromFile</code>. </p> <p>The return value is the value you pass to the function-caller, when you close your function. This is what you usually see in Code as <code>return var;</code></p> <p>In your particular case, this return value is from the type <code>char *</code>. The <code>*</code> determines it as a pointer, so when the function closes it returns a character-pointer. </p> <p>Next, there are your two function arguments:</p> <p><code>char *arrayOfThings</code>:</p> <p>Obviously, this is also an character pointer, only that at this point it's an function argument, which means you have to supply it to the function. </p> <p><code>int &amp;arraySize</code>:</p> <p>The <code>&amp;</code> determines the required parameter as a so called <strong>reference</strong> (in this case to an integer). Reference means, that the functions expects a normal variable (here: just a normal integer, no pointer), but it will treat it as a reference, which means that internally it actually just uses your original variable. This is important for you to know, since this means that changes to the variable in your function are global and not only local in the function itself (remember: when you pass normal parameters to a function you can just change them, without seeing any of that in the calling function).</p> <p>Now to come back to <code>structure</code> - regarding the <code>*</code> and <code>&amp;</code> operators, it behaves the same for <code>structure</code> as it would do for <code>char</code> or <code>int</code> (it's just a pointer/reference to a structure theN). The <code>structure</code> itself just reprents a data type in this case.</p>
    singulars
    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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      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