Sunday, 15 June 2014

c - difference between a[10] and 10[a] -



c - difference between a[10] and 10[a] -

this question has reply here:

with c arrays, why case a[5] == 5[a]? 13 answers

following code

a[10] == 10[a]

the result seems true in c-language

how c compiler sees both of them same ?

a[10] means: "start @ memory address 10, add together , reference resulting location" 10[a] means: "start @ memory address a, add together 10 , reference resulting location"

since + 10 same 10 + a, both expressions refer same memory location.

c arrays

No comments:

Post a Comment