title: How to get total number of elements in the structure
body: <p>Here is my code..</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  struct new {
      unsigned short b0 = 0;
      unsigned short b1 = 0;
      unsigned short b2 = 0;
      unsigned short b3 = 0;
      unsigned short b4 = 0;
      unsigned short b5 = 0;
      unsigned short b6 = 0;
      unsigned short b7 = 0;
  };
  
  int main()
  {
      printf("Bit Field Example\n");
      struct new b; //Seems wrong to me
      int result = sizeof(b)/sizeof(*b); //Seems wrong to me
      printf("Size: %d\n", result);
      return 0;
  }
  </code></pre>
  
  <p>I am using a linux machine to compile the mentioned code. I know that the line below is wrong..</p>
  
  <pre><code>int result = sizeof(b)/sizeof(*b);
  </code></pre>
  
  <p>But I am not sure about any other technique. First of all, Is it possible to count total number of elements in the structure.? Please give me some idea about how to do it.</p>
  
  <p>Thanks in advance.</p>