title: Bitvector Struct error
body: <p>I am trying to write a program to use these functions from the header BV.h.  I keep getting an error when trying to use setBit, clrBit, valBit, and printV.</p>
  
  <p>I believe it has to do with the [pos] part of the code, but I am not really sure.</p>
  
  <p>bv.c</p>
  
  <pre><code>//bv.c  
  #include &lt;stdio.h&gt;
  #include "bv.h"
  #include &lt;stdlib.h&gt;
  
  bitV* newVec(uint32_t length){
      bitV* v = malloc(sizeof(bitV));
      (*v).l = length;
      return v;
  }
  
  void delVec(bitV* v){
      free(v);
  //  *v = NULL;
  }
  
  void oneVec(bitV* v){
      for(int i = 0;(unsigned)i &lt; (v-&gt;l); i++){
          (*v).head = 1;
      }
  }
  
  void setBit(bitV* v, uint32_t pos){
      (*v).head[pos] = 1;
  }
  
  void clrBit(bitV* v, uint32_t pos){
      v-&gt;head[pos] = 0;
  }
  
  uint8_t valBit(bitV* v, uint32_t pos){
      return v-&gt;head[pos];
  }
  
  uint32_t lenVec(bitV* v){
      return v-&gt;l;
  }
  
  void printV(bitV* v){
      for(int i = 0;(unsigned) i &lt; (v-&gt;l); i++){
          printf("%d\n",valBit(v,i));
      }
  }
  </code></pre>
  
  <p>bv.h</p>
  
  <pre><code>// bv.h — Bit Vector interface
  
  
  # ifndef _BVector
  # define _BVector
  # include &lt;stdint.h&gt;
  
  typedef struct bitV {
      uint8_t *head;
      uint32_t l;
  } bitV;
  
  bitV *newVec(uint32_t);
  
  void delVec(bitV *);
  
  void oneVec(bitV *);
  
  void setBit(bitV *, uint32_t);
  
  void clrBit(bitV *, uint32_t);
  
  uint8_t valBit(bitV *, uint32_t);
  
  uint32_t lenVec(bitV *);
  
  void printV(bitV *);
  # endif
  </code></pre>