title: Difference between passing integer as reference and structure as reference in C
body: <p>Code1:</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  
  void change(int *);
  
  void main()
  {
    int i=5;
    change(&amp;i); 
    printf("The number has changed to:%d\n",i);
  }
  
  void change(int *a)
  {
    *a=*a+5;
  }
  </code></pre>
  
  <p>Code2:</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  
  #define SIZE 10
  
  struct terms
  {
    int coeff;
    int expo;
  };
  
  struct poly
  {
    struct terms t[SIZE];
    int noofterms;
  };
  
  void initpoly(struct poly *);
  
  void main()
  {
    struct poly p1;
    initpoly(&amp;p1);
  }
  
  void initpoly(struct poly *p)
  {
    *p-&gt;noofterms=0;
  }
  </code></pre>
  
  <p>In code1 if I want to change the value of variable <code>i</code>, I have to change through <code>*a=*a+5</code> but when I do the same thing in code2 it gives error. What's the difference?</p>