We can pass an array as a variable in a C/C++ function header, as in
int func(int arr[]) { ... }
I’m wondering: Is it ever possible that something goes inside the [] in a variable that’s passed into the function header, or is it always empty?
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.
For any (non-reference) type
T, the function signaturesR foo(T t[])andR foo(T t[123])(or any other number) are identical toR foo(T * t), and arrays are passed by passing the address of the first element.Note that
Tmay itself be an array type, such asT = U[10].