I declared a two-dimensional array as follows:
char *array[][3] = { {"a", "b", "c"}, {"d", "e", "f"}, {"u", "v", "w"}, {"x", "y", "z"}};
How to find out the first dimension?
Example: *
#include <stdio.h> int main(void) { int array[4]; printf("%zd\n", sizeof array / sizeof array[0]); printf("%zd\n", sizeof (int)); printf("%ld\n", (long)(sizeof array / sizeof array[0])); return 0; }
type-name
sizeof
generic-associations
cast-expressions
:
sizeof(array) / sizeof(char*) / 3
?
, (char *) (3).
, , , .
, 'sizeof("a")', , , , (2, "a" "\ 0" ), (4 32- ). , - ?: -)
'sizeof("a")'