Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><code>1000</code> in hex is <code>0x3E8</code>. <em>If</em> your system stores an <code>int</code> as a little-endian 32-bit value, then <code>x</code> is stored like this in memory:</p> <pre><code>+------+------+------+------+ | 0xE8 | 0x03 | 0x00 | 0x00 | +------+------+------+------+ ^ | ---increasing addresses---&gt; &amp;x </code></pre> <p>For the first case:</p> <p><em>If</em> your system has an 8-bit <code>char</code>, when you assign <code>&amp;x</code> to <code>char *ptr</code> and then dereference it, you get the value <code>0xE8</code> interpreted as a <code>char</code>.</p> <p><em>If</em> your system treats the <code>char</code> type as signed, and <em>if</em> the signed representation is 2's complement, then <code>0xE8</code> is interpreted as <code>-24</code>.</p> <p>For the second case:</p> <p><em>If</em> your system has a little-endian 32-bit <code>float</code>, when you assign <code>&amp;x</code> to <code>float *ptr</code> and then dereference it, you get the value with a bit pattern of <code>0x000003E8</code> interpreted as <code>float</code>.</p> <p><em>If</em> your system represents <code>float</code> in the IEEE 754 format, then the most significant bit represents the sign (0 means it's positive), the next 8 most significant bits represents the exponent (0 means that the number is zero or denormalized - very small), and the remaining 23 bits represent the "significand" or "mantissa" (0x3E8 or 1000). This actually has the value 1000 * 2<sup>-149</sup>, which is approximately 1.4013 * 10<sup>-42</sup> - you can see this value by using <code>%g</code> instead of <code>%f</code> in the <code>printf</code> format string.</p>
    singulars
    1. This table or related slice is empty.
    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