3 ms·
sizeof() is used to determine the actual in-memory size of something for use by memcpy/malloc/etc., not the number of elements. There are commonly-used array s
by nitrogen 17y ago
sizeof() is used to determine the actual in-memory size of something for use by memcpy/malloc/etc., not the number of elements. There are commonly-used array size macros that can help with this, such as
#define ARRAY_SIZE(x) sizeof(x)/sizeof((x)[0])