title: Universal macro for getting number elements in array or return just 1 when is used on variable?
body: <p>In C language macro for getting number of array elements is well known and looks like this: </p>
  
  <pre><code>uint32_t buffer[10];
  
  #define ARRAY_SIZE(x)     sizeof(x)/sizeof(x[0])
  
  size_t size = ARRAY_SIZE(buffer);
  </code></pre>
  
  <p>The question is, is there any universal macro for getting array elements or returning just one when it's used on variable ? I mean following usage of macro : </p>
  
  <pre><code>uint32_t buffer[10];
  uint32_t variable;
  
  #define GET_ELEMENTS(x)     ???
  
  size_t elements_of_array = GET_ELEMENTS(buffer); // returns 10
  size_t elements_of_variable = GET_ELEMENTS(variable); // returns 1
  </code></pre>
  
  <p>Does anybody know the solution ? </p>
  
  <p>I've edited my question because it was wrongly formulated, BTW I know that I can use : </p>
  
  <pre><code>sizeof(variable)/sizeof(uint32_t)
  </code></pre>
  
  <p>Question is how to combine it in one macro or maybe inline function is better solution ? </p>