5 ms·
My C is really weak (I'm a Ruby guy) but here's the best I can do. Two things make this work: 1, in C, an array can be treated like a pointer that points to th
by ivey 18y ago
My C is really weak (I'm a Ruby guy) but here's the best I can do.
Two things make this work: 1, in C, an array can be treated like a pointer that points to the first element of the array. 2, pointers have a subscript notation.
That is, for a pointer p, p[i] is the same is * (p + i). (where pointer addition goes by sizeof the thing pointed to).
So, a[5] is really * (a + 5) ... and 5[a] is * (5 + a). Same thing, although 5[a] looks really weird and will make people hate you if you use it.
http://www.ibiblio.org/pub/languages/fortran/append-c.html http://www.ibiblio.org/pub/languages/fortran/append-c.html was helpful in reminding me of the specifics, since I couldn't find my K&R.
- nopassrecover 18y agoAwesome thanks :-)