Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You would not have asked that question if you had asked the compiler to help you (No offense!). The compiler is your friend. Enable it's warnings. For example GCC with</p> <pre><code>gcc -Wall yourcode.c </code></pre> <p>gives you</p> <pre><code>yourcode.c: In function ‘fill’: yourcode.c: 11:5: warning: implicit declaration of function ‘send’ yourcode.c: At top level: yourcode.c:15:5: warning: return type defaults to ‘int’ yourcode.c:22:5: warning: return type defaults to ‘int’ yourcode.c: In function ‘send’: yourcode.c:26:5: warning: control reaches end of non-void function yourcode.c: In function ‘main’: yourcode.c:19:5: warning: control reaches end of non-void function </code></pre> <p>Now you know that you should have written a prototype for function <code>send</code> or moved it's definition above the first usage. And as the compiler assumes a default return type for <code>send</code> you obviously forgot to specify it (here apparently <code>void</code> as you don't have any return value). For <code>main</code> the return type <code>int</code> and an </p> <pre><code>return 0; </code></pre> <p>is missing.</p> <p>With the said modifications the compiler will tell you</p> <pre><code>yourcode.c: In function ‘fill’: yourcode.c:12:5: error: incompatible type for argument 1 of ‘send’ yourcode.c.c:7:6: note: expected ‘struct xxx *’ but argument is of type ‘struct xxx’ </code></pre> <p>and you will notice you have one redundant * in</p> <pre><code>send(*create); </code></pre> <p>which dereferences your pointer. Note: You do NOT want to dereference your pointer, because you have to forward <em>the pointer</em> to <code>send</code> and not the value. Change the line to</p> <pre><code>send(create); </code></pre> <p>et Voilà.</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. This table or related slice is empty.
    1. 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