Hi I'm stuck wondering how an array assignment is legal.
num[i] equals *( num + i) equals *(i + num ) equals i[num]
It's the last assignment I'm unsure about, how can example 1[num] equals num[1]?
There is some grave lacking in my understanding about the C language, perhaps this is quite known logic?
Can somebody give me a reference to read up on when it comes to this specifically?
Where did you learn it's equal? num[i] and i[num] are two very different things, starting from the fact that the first refers to an array called num and the second to an array called i.
Oh yeah right. The square brackets are syntactic sugar for *(address + offset). So doing i[num] is like saying *(offset + address) which leads to dereferencing the same memory address as the first one.
I don't know any book, I studied using the Kernighan&Ritchie but I didn't find it much newbie friendly. You can try googling 'pointer arithmetics' to get some more info on the subject.