title: which one is wrong?
body: <pre><code>#include &lt;stdio.h&gt;
  typedef struct {int a; int b; int c;} F;
  typedef struct{
      int a;
      int (*ptr)(F*);
  } A;
  
  int set_a(F * obj){
      obj-&gt;a = 1;
  }
  int main(){
      F a;
      A b;
      b.a = 0;
      b.ptr = set_a;
      b.ptr(&amp;a);
      printf("%d",a.a);
  
      getchar();
  }
  </code></pre>
  
  <p>this seems correct</p>
  
  <p>but why</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  typedef struct{
      int a;
      int (*ptr)(A*);
  } A;
  
  int set_a(A * obj){
      obj-&gt;a = 1;
  }
  int main(){
      A a;
      a.a = 0;
      a.ptr = set_a;
      a.ptr(&amp;a);
      printf("%d",a.a);
  
      getchar();
  }
  </code></pre>
  
  <p>this is incorrect? and</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  typedef struct{
      int a;
      int (*ptr)(A);
  } A;
  
  int set_a(A * obj){
      obj-&gt;a = 1;
  }
  int main(){
      A a;
      a.a = 0;
      a.ptr = set_a;
      a.ptr(&amp;a);
      printf("%d",a.a);
  
      getchar();
  }
  </code></pre>
  
  <p>this is correct?
  I really wonder
  thanks</p>
  
  <p>environment Language C on Visual studio 2012 on Windows 7</p>