title: Pointers in array of float
body: <p>I have some doubts regarding the output of the program.</p>
  
  <p><a href="https://i.stack.imgur.com/KXDeU.png" rel="nofollow noreferrer">This is the picture where I am using %f to print j, *j and a[4]</a></p>
  
  <p><a href="https://i.stack.imgur.com/M8n4c.png" rel="nofollow noreferrer">In this pisture I've used %d to print j, *j and a[4]</a></p>
  
  <p>Here is the code that I've used-</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  int main()
  {
  float a[]={13.24,1.5,1.5,5.4,3.5};
  float *j;
  j=a;
  j=j+4;
  printf("%f %f %f\n",j,*j,a[4]);
  return 0;
  }
  </code></pre>
  
  <p>My doubt is that if I consider j then j represents the address of 3.5 here according to me because at first it was pointing to the base address of a[] and then we added 4 to j. So in case of %d, j should print the address of 3.5. And in case of %f also it should print the address of j. As here I've considered %d so I'm getting a negative value but if I had used %u then I would have got the address of 3.5. But in case of %f why is it printing the value 3.500000 instead of address?</p>
  
  <p>Next moving on to *j, while using %d, why is it printing some garbage value? I mean it should print 3 according to me as I've used %d for a float value(3.5). </p>
  
  <p>Lastly, I don't understand why in case of a[4], 0 is being printed. As a[4] means 3.5 then why is it not printing that?</p>
  
  <p>Please help. Thanks! </p>