Is this from the C standard?
Share
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.
Because declarations in C follow the operator precedence rules (ie array subscription is evaluated before indirection), you’ll need parens to declare pointers to array types.
In many use cases, there’s not really any practical benefit over using a plain
char *, except that it’s a way to enforce the array size, especially when used as a function parameter:is equivalent to
and accepts any
char *, whereaswill only accept pointers to arrays of size
42.As accessing the elements of
barin the latter case is cumbersome, it might be a good idea to immediately define an equivalentchar *in the function bodyso that you can use direct subscription
baz[13]instead of(*bar)[13].