title: When to use bit-fields in C
body: <p>On the question 'why do we need to use bit-fields?', searching on Google I found that bit fields are used for flags.</p>
  <p>Now I am curious,</p>
  <ol>
  <li>Is it the only way bit-fields are used practically?</li>
  <li>Do we need to use bit fields to save space?</li>
  </ol>
  <p>A way of defining bit field from the book:</p>
  <pre><code>struct {
      unsigned int is_keyword : 1;
      unsigned int is_extern :  1;
      unsigned int is_static : 1;
  } flags;
  </code></pre>
  <ol start="3">
  <li>Why do we use int?</li>
  <li>How much space is occupied?</li>
  </ol>
  <p>I am confused why we are using <code>int</code>, but not <code>short</code> or something smaller than an <code>int</code>.</p>
  <ol start="5">
  <li>As I understand only 1 bit is occupied in memory, but not the whole unsigned int value. Is it correct?</li>
  </ol>