Snippet.C: Getting the length of an array.
The following C macro gets the amount of memory the array uses and divides it by the size of the first position:
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x)[0])
Credits go to meqif.
The following C macro gets the amount of memory the array uses and divides it by the size of the first position:
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x)[0])
Credits go to meqif.