title: Difference between "->" and "." in C
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/2575048/arrow-operator-usage-in-c">Arrow operator (-&gt;) usage in C</a>  </p>
  </blockquote>
  
  
  
  <p>I am trying to figure out the difference between the "." and "->" styles of data access in C language.
  Eg.</p>
  
  <pre><code>struct div{
      int quo;
      int rem;
  };
  </code></pre>
  
  <p>1) Using "->"    </p>
  
  <pre><code>struct div *d = malloc(sizeof(struct div));
  d-&gt;quo = 8/3;
  d-&gt;rem = 8%3;
  printf("Answer:\n\t Quotient = %d\n\t Remainder = %d\n-----------\n",d-&gt;quo,d-&gt;rem);
  </code></pre>
  
  <p>2) Using "."</p>
  
  <pre><code>struct div d;
  d.quo = 8/3;
  d.rem = 8%3;
  printf("Answer:\n\t Quotient = %d\n\t Remainder = %d\n-----------\n",d.quo,d.rem);
  </code></pre>
  
  <p>I am getting the same output for both the cases.</p>
  
  <blockquote>
    <p>Answer:  Quotient = 2  Remainder = 2</p>
  </blockquote>
  
  <p>How these two approaches are working internally? And at what time which one should be used?
  I tried searching it on the internet but of not much help. Any relevant link is also appreciated.</p>
  
  <p>Also is there any difference between their storage in memory?</p>