title: using strcpy to copy a string to a member of a structure via the pointer operator
body: <p>I'm trying to use strcpy to set values for a char array which is the member of a structure. I want to do this using the pointer operator if possible.</p>
  
  <pre><code>struct my_struct{
    char foo[15];
  } *a_struct_Ptr;
  
  int main(){
    strcpy(a_struct_Ptr -&gt; foo, "test");
  return 0;
  }
  </code></pre>
  
  <p>I can compile this code but when I go to run it I get a segmentation fault. </p>
  
  <p>Also it seems to work fine if I don't define the struct as a pointer, for example the following code works fine...</p>
  
  <pre><code>struct my_struct{
    char foo[15];
  }a_struct;
  
  int main(){
    strcpy(a_struct.foo, "test");
    return 0;
  }
  </code></pre>
  
  <p>I want to be able to do this with pointers though.
  Any feedback is appreciated. Thanks</p>