title: 'variable' may be used uninitialized in this function, have a working workaround but don't understand why
body: <p><strong><em>I have searched and found a lot of similar questions (with undoubtly good answers) but I haven't found one that I understand completely. I have found a solution that does work and I am really just trying to understand what I do wrong in the first example...</em></strong></p>
  
  <p>I wrote a function that calculates pitch/roll from raw accelerometer values with declaration:</p>
  
  <pre><code>uint8_t calcPitchRoll (imu_t * imu, float * pitch, float * roll);
  </code></pre>
  
  <p>The calling function looks like (line numbers for reference):</p>
  
  <pre><code>518 float * pRollValue, * pPitchValue; // prepare pointers to floats to store results
  519 *pRollValue = 0; // initialize variables
  520 *pPitchValue = 0; // initialize variables
  521 calcPitchRoll (imu, pPitchValue, pRollValue);
  </code></pre>
  
  <p>However, that results in the compiler warnings:</p>
  
  <pre><code>main.c:519:25: warning: 'pRollValue' may be used uninitialized in this function
  main.c:521:26: warning: 'pPitchValue' may be used uninitialized in this function
  </code></pre>
  
  <p>The following however does work:</p>
  
  <pre><code>float PitchValue, RollValue = 0;
  float * pRollValue = &amp;RollValue;
  float * pPitchValue = &amp;PitchValue;
  calcPitchRoll (imu, pPitchValue, pRollValue);
  </code></pre>
  
  <p>To me, both examples seem to have the same "state" when calling the calcPitchRoll function, but the compiler disagrees. </p>
  
  <p>What I (think I) understood is that <code>*pRollValue = 0</code> writes that value to the variable, so I'd think at that point the variable has space allocated ànd a value. Is that an incorrect understanding?</p>