A friend asked me to write a function in C to return the 100th element of an array. I\'m not very familiar with C, so I wasn\'t sure how to make a generic function that coul
In C, the bracket notation is short hand for pointer arithmetic. A normal use like x[i]
is syntactically equivalent to *(x + i)
(remember that arrays are pointers). If instead you had used i[x]
then it's the same as *(i + x)
and produces the same output. As noted by other answers, this approach is not a function, just an interesting technique.