Almighty Bus Error

Blog about computer science, code snippets and tips.

GitHub repository with examples.
The author is a Computer Engineering student at FCT/UNL.
rss
May 03, 2009 at 15:36
Tags:  Snippet C

Comments (View)

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.

[top]

[top]