user29041: I'm learning Arduino (school and from myself).
We have the following code:
temp = Wire.read();
temp = ~temp;
temp = temp - 1;

This code is made to read, then print positive and negative values from a temp sensor. If you need more parts of the code, let me know.
I don't understand what does the ~ symbol, can someone help me?
Thanks.

user368: As always, ~ in C++ is bitwise negation.

29041: <p>I'm learning Arduino (school and from myself).</p>

<p>We have the following code:</p>

<pre><code>temp = Wire.read();
temp = ~temp;
temp = temp - 1;
</code></pre>

<p>This code is made to read, then print positive and negative values from a temp sensor. If you need more parts of the code, let me know.</p>

<p>I don't understand what does the <code>~</code> symbol, can someone help me?</p>

<p>Thanks.</p>
 368: <p><a href="https://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B" rel="nofollow noreferrer">As always, <code>~</code> in C++ is bitwise negation.</a></p>
