Skip to content

Instantly share code, notes, and snippets.

@bemaru
Created December 13, 2017 00:39
Show Gist options
  • Select an option

  • Save bemaru/47a3e4d615cce1be522dddc7445ab8f9 to your computer and use it in GitHub Desktop.

Select an option

Save bemaru/47a3e4d615cce1be522dddc7445ab8f9 to your computer and use it in GitHub Desktop.
c/c++ calculate array size
#ifndef ARRAYSIZE
// There is a better way, but this is good enough for our purpose.
# define ARRAYSIZE(a) (sizeof(a) / sizeof(*(a)))
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment