title: how to access a member of a structure using a pointer offset
body: <p>/* Trying to copy a value from member of one structure to another using pointers and structure offset: */</p>
  
  <pre><code>enter code here
  
  typedef struct
  {
      uint8 Value;
      uint8 Status;
  } sts;
  
  typedef struct
  {
     sts CC1;
     sts CC2;
     sts CC3;
     sts CC4;
  } StructTypeWrite;
  
  typedef struct
  {
     uint8 CC1;
     uint8 CC2;
     uint8 CC3;
     uint8 CC4;
  } StructTypeRead;   
  
  static StructTypeWrite WriteVariable;
  static StructTypeRead ReadVariable;
  
  void main(void)
  {
      StructTypeWrite *WritePtr;
      StructTypeRead *ValPtr;
      uint8 i;
  
      /* Just Writing Value in order to check */
      WriteVariable.CC1.Value = 5;
      WriteVariable.CC2.Value = 30;   
      WriteVariable.CC3.Value = 40;   
      WriteVariable.CC4.Value = 45;
  
      WritePtr = &amp;WriteVariable;
      ValPtr = &amp;ReadVariable;
  
      for(i=0; i&lt;4; i++) 
      {
          /* Need to copy all the members value to another structure */
          *((uint8*)ValPtr + i) = *((sts*)(uint8*)WritePtr + i)-&gt;Value;
      }
  }
  </code></pre>
  
  <p>error during compilation is :
  error #75: operand of "*" must be a pointer
              <em>((uint8</em>)ValPtr + i) = <em>((sts</em>)(uint8*)WritePtr + i)->Value;</p>
  
  <p>Can anyone help me where am i wrong ?</p>