Loading...
 
Skip to main content

System Workbench for STM32


Defining a Macro to Return the Number of Elements in an Array

I use this in OpenStm32 and with other toolsets:

#define COUNT_OF(x) ((sizeof(x)/sizeof(0x)) / ((size_t)(!(sizeof(x) % sizeof(0x)))))


See this for more info.