following code
a[10] == 10[a]
the result seems true in C-language
how C compiler sees both of them as the same ?
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.
a[10] means: “Start at memory address 10, add a to it and reference the resulting location”
10[a] means: “Start at memory address a, add 10 to it and reference the resulting location”
Since a + 10 is the same as 10 + a, both expressions will refer to the same memory location.