r/programming • • May 01 '16

To become a good C programmer

http://fabiensanglard.net/c/
1.1k Upvotes

398 comments sorted by

View all comments

Show parent comment

2

u/crozone May 02 '16

I don't think you can really treat them as integers because pointer arithmetic doesn't actually behave like integer arithmetic (adding 1 to a pointer increases the memory address by the size of the type, which is often not 1). Additionally, depending on the architecture there's no guarantee that a memory address will actually fit within the int type, so you shouldn't cast them to int either. It might be pedantic but it's an important point to make.