title: passing pointer to static struct object
body: <p>I am trying to modify a static struct object by passing its pointer to another function and modifying it by pointer inside that. <strong>But even after execution of modifying function, the values of the struct are intact.</strong></p>
  
  <pre><code>void some_functon_a(....)
  {
      static struct some_struct obj;
      modifier_function_b(&amp;obj);
      // obj is not modified as expected in fact not at all
  }
  
  void modifier_function_b(struct some_struct *ptr)
  {
      // modifying the struct using ptr 
  }
  </code></pre>
  
  <p>Also when I run gdb on this code, I see as soon as code flow enters modifier_function_b() function gdb reports two entries for variable ptr: ptr and ptr@entry. All the modifications are being done on ptr, while ptr@entry which points to real location of obj is not modified.  Can somebody point out what may be happening here? Are pointer to static variables kind of const pointers and we can't modify them outside their scope?</p>
  
  <p>One more thing... this behavior is not seen if i remove static qualifier, which led me to think that pointer to static is kind of const pointer.</p>
  
  <p>Thanks in advance :) </p>