I declared a 2-dimensional array like this:
char *array[][3] = {
{"a", "b", "c"},
{"d", "e", "f"},
{"u", "v", "w"},
{"x", "y", "z"}};
How do I find out the first dimension?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
sizeof array / sizeof array[0]
Example:*
*You need the parens if the operand is a
type-name, even thoughsizeofis an operator not a function. But every place where atype-nameappears in the C grammar (declarators don’t use that production) then parens are required around it. Because there isn’t a separate production for a type-name-in-parens in the semi-formal grammars used for the various C specs, they specify the needed parens in the productions that define things likesizeof,generic-associations, andcast-expressions. But those parens are really there in order to be able to parse a type within the expression grammar. They are part of the syntax for something you might call “type expressions,” but given the limited use of such things they don’t actually have any such production or term.