title: How to initialize a pointer to a struct in C?
body: <p>Given this struct: </p>
  
  <pre><code>struct PipeShm
  {
      int init;
      int flag;
      sem_t *mutex;
      char * ptr1;
      char * ptr2;
      int status1;
      int status2;
      int semaphoreFlag;
  
  };
  </code></pre>
  
  <p>That works fine: </p>
  
  <pre><code>static struct PipeShm myPipe = { .init = 0 , .flag = FALSE , .mutex = NULL , 
          .ptr1 = NULL , .ptr2 = NULL , .status1 = -10 , .status2 = -10 , 
          .semaphoreFlag = FALSE };
  </code></pre>
  
  <p>But when I declare <code>static struct PipeShm * myPipe</code> , that doesn't work , I'm assuming that I'd need to initialize with the operator <code>-&gt;</code>, but how? </p>
  
  <pre><code>static struct PipeShm * myPipe = {.init = 0 , .flag = FALSE , .mutex = NULL , 
          .ptr1 = NULL , .ptr2 = NULL , .status1 = -10 , .status2 = -10 , 
          .semaphoreFlag = FALSE };
  </code></pre>
  
  <p>Is it possible to declare a pointer to a struct and use initialization with it?</p>