Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>A detail here, the "inequalities" you're asking about are about pointers, not arrays. Think of comparing memory locations, and the following will be easier to follow.</p> <ul> <li>First one should be pretty straightforward: print each element of the array in order (<code>a[0]</code>, <code>a[1]</code>, etc.)</li> <li>In number 2, <code>p</code> is the address of element <code>0</code> of <code>a</code>. <code>p++</code> increases that address to be address of the next element in the array.The termination condition can be read as "<code>p</code> is less or equal the address of element number 4 of the array". To put some values and make this concrete: imagine <code>&amp;a[0]</code> is <code>200</code>, as a consequence <code>&amp;a[4]</code> is <code>216</code>, as <code>p</code> is incremented it becomes <code>204, 208, 212, 216</code>, and finally <code>220</code>. When it becomes <code>220</code> the condition becomes false, and the loop ends.</li> <li>Number 3's left side is similar but instead of increasing <code>p</code> it adds <code>i</code> to <code>p</code>. Note that thanks to the magic of pointer arithmetic <code>p + 1</code> is actually <code>p + i*(sizeof(*p))</code>. The sequence is exactly the same as in case 2. BTW, initialization should be <code>p = &amp;a[0]</code>, <code>i=0;</code> (note the comma before the <code>i</code>). For the right side <code>(a+4)</code>, the plain a means the address of the first element of a (this is the C equivalency between pointers and arrays, <code>a</code> topic full of subtleties and pain). <code>a + 4</code> is thus equivalent to <code>&amp;a[4]</code>.</li> <li>Number 4 is there to mess with your head. The information above should be enough to translate the initialization and condition; but having both <code>i++</code> and <code>p++</code> means you will be advancing 2 elements each iteration.</li> </ul> <p>The use of the preprocessor here is likely obscuring what gets called, try expanding manually to follow up more easily. and PRD should be adding a space after each number for easier reading.</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.
    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