title: Using Pointer to Struct to read member Variables
body: <pre><code>#include&lt;stdio.h&gt;
  
  struct data{
      int i;
      struct data *p;
  };
  
  int main() {
      struct data *p=malloc(sizeof(struct data));
  
      //How do i use pointer to structure to read a integer in member variable i?
  
      scanf("%d",&amp;p-&gt;i);    // I am advised to use this,Can you interpret this??
      scanf("%d",&amp;(*p).i);  // Is this valid?
      scanf("%d",p-&gt;i);     // Why is this not valid since p is nothing but a pointer 
  }
  </code></pre>
  
  <ol>
  <li><p>Interpret this  <code>&amp;p-&gt;i</code>. Why this represents the address of the member variable i?</p></li>
  <li><p>Is this  <code>scanf("%d",&amp;(*p).i);</code> valid? Why?</p></li>
  </ol>