title: implement the bit map in the following situation
body: <p>My question is how to implement the bit map in the following situation?<br>
  If a vertex of a graph is in a minimum spanning tree (MST), mark the corresponding bit; later on check whether it is in the MST by checking the bit. </p>
  
  <p>At beginning, I was thinking of using         </p>
  
  <pre><code>typedef struct bit_t{    
     char bit0:1;
  } bit;       
  
  bit bitmap[num_of_vertex];     
  </code></pre>
  
  <p>And use bitmap array to record the bit;</p>
  
  <p>But then I found the sizeof (bitmap[num_of_vertex]) is num_of_vertex byte, not num_of_vertex/8 byte. so it is not saving space like what I thought;</p>
  
  <p>So far I use    </p>
  
  <pre><code>long bit_record = 0;   
  ...
  bit_record |= 1&lt;&lt; u;//set vertex as in MST    
  ...    
  </code></pre>
  
  <p>then later on check whether vertex is in MST using:    </p>
  
  <pre><code>static bool is_in_MST(int v, int bit_record){   
      int mask = 1 &lt;&lt;  v;   
      if (mask &amp; bit_record)    
          return true;   
      else    
          return false;   
  }      
  </code></pre>
  
  <p>Though the code works, it will not work if num_of_vertex is larger than 32.   </p>
  
  <p>How in general a bitmap in the above situation is implemented?    </p>