title: How to set C pointer to array in function
body: <p>What do I misunderstand about processing pointers ? <br>
  I have CAN1_msg_t buffer with in/out pointers <br>
  I want to set pCAN1RxMsg pointer to eq. c1rxbuf->buf[0] in my CAN1GetPtr() function.</p>
  
  <pre class="lang-c prettyprint-override"><code>struct CAN1_msg_t {
      uint8_t flags;
      uint32_t id;
      uint8_t data[8];
  };
  
  struct can1_buf_st
  {
      unsigned int in;    // In Index
      unsigned int out;   // Out Index
      struct CAN1_msg_t buf[100];   // Buffer
  };
  
  int CAN1GetPtr(struct CAN1_msg_t *pcan)
  {
      struct  can1_buf_st *p = &amp;c1rxbuf;
  
      pcan =  &amp;(p-&gt;buf[p-&gt;out++]);
  
      return 1;
  }
  
  static struct can1_buf_st c1rxbuf = { 0, 0, };    
  
  void main()
  {
      struct CAN1_msg_t  *pCAN1RxMsg;
  
      if(CAN1GetPtr(pCAN1RxMsg)) {
  
          if((*pCAN1RxMsg).id == 0x100) {
              (...)
          }
      }   
  }
  </code></pre>