 <p>This is the classic <strong>assignment in conditional</strong> error - the expression is evaluated as following (because comparison has higher <a href="http://www.difranco.net/compsci/C_Operator_Precedence_Table.htm">precedence</a> then assignment):</p> <pre><code>if ( killedpid = ( wait( &amp;status ) &gt;= 0 )) { ... </code></pre> <p>The <code>killedpid</code> will get a value of TRUE, which is <code>1</code> in C. To get around this use parenthesis and <strong>compile with high warning levels</strong> like <code>-Wall -pedantic</code>:</p> <pre><code>if (( killedpid = wait( ... )) &gt;= 0 ) { ... </code></pre>