title: Typecasting int pointer to float pointer
body: <p>I'm trying to do the following</p>
  
  <pre><code>int a[8]={1,2,3,4,5,6,7,8};
  
  printf("%f\n", *(float *)a);
  printf("%f\n", *((float *)a+1));
  printf("%f\n", *((float *)a+2));
  printf("%f\n", *((float *)a+3));
  printf("%f\n", *((float *)a+4));
  printf("%f\n", *((float *)a+5));
  printf("%f\n", *((float *)a+6));
  printf("%f\n", *((float *)a+7));
  </code></pre>
  
  <p>I get </p>
  
  <pre><code>0.000000
  0.000000
  0.000000
  0.000000
  0.000000
  0.000000
  0.000000
  0.000000
  </code></pre>
  
  <p>The reason why I'm trying to print the elements in this way is because, I want to cast the int pointer to the array to the float pointer and pass it as a parameter for another function which only takes <code>float *</code>. </p>
  
  <p>It seems that this does not work well. Can someone explain why this is not working? </p>
  
  <pre><code>int *ptr;
  function((float *)ptr);
  </code></pre>
  
  <p>If I do this the function does not read the values the pointer is pointing to properly.. just returning <code>0.0000</code>.</p>