Re:Ask HN: Favorite pointer tricks in C?
by dgallagher on Saturday November 20, 2010 @08:02PM
(#1925862)
The same as above, only using Pointer Arithmetic instead of Array Subscripting:
Further broken down:
[ Parent
| on HN ]
Re:Ask HN: Favorite pointer tricks in C?
by jallmann on Saturday November 20, 2010 @08:36PM
(#1925926)
Yep. And if teaching that to a bunch of middle or high schoolers, I would add that pointer arith works in increments of sizeof(array[0]) bytes. If you're not careful about operator precedence in moderately complicated expressions, that could come back to bite you.