+ 2
(C challenge Question) Calling a function f with an array variable a[3], where a is an array is equivalent to:
Q. Calling a function f with an array variable a[3], where a is an array is equivalent to: --> f(a[3]) --> f(* (a + 3)) --> f(3[a]) --> all the mentioned ## its correct answer is [option 4] // i don't know how option 3 is also correct.
5 odpowiedzi
+ 2
Since a[3] is translated into *(a+3), then 3[a] is translated into *(3+a), which is exactly the same, because the addition is commutative.
+ 3
BlackShadow334
I don't know about other languages but I'm sure that this is working in C++, C, and not in Python. In other words, not working on all languages.
+ 2
As far as I know, in C:
array[index] == index[array]
+ 1
《 Nicko12 》 Thanks man i didn't knew that, but is it applicable for all language or only for C.
0
i got this question in c challenge, and i lost it. 🤕
// i understand that option 1 and 2 are correct, but i dont understand, why option 3 is also correct.
// can anyone explain this??