title: C Pointer for Struct - Segmentation fault
body: <p>I am having problems with this program. It's very simply. I need to assign values to my struct from the pointers I created, but I keep getting a segmentation fault. Any ideas what I'm doing wrong:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  struct problem37
  {
      int a;
      int b;
      int c;
  };
  
  int main()
  {
      printf("Problem 37\n");
  
      //create struct
      struct problem37 myStruct;
  
      //create the pointer
      int* p;
      int* q;
      int* r;
  
      *p = 1;
      *q = 5;
      *r = 8;
  
      //read the data into the struct using the pointers
      myStruct.a = *p;
      myStruct.b = *q;
      myStruct.c = *r;
  
      printf("%d\n", myStruct.a);
      printf("%d\n", myStruct.b);
      printf("%d\n", myStruct.c);
  
      return 0;
  }
  </code></pre>