Isaac Marino Bavaresco wrote: >> BTW I don't see 'const' being used anywhere, but I thought a const >> byte * meant not that the pointer couldn't change, just the >> pointer's own address didn't. But see, there's two more questions, >> (1) to see if I'm right, and (2) to see if the compiler got it right >> :) > > When 'const' is to the left side of the asterisk, it means that the > element pointed by the pointer must not be changed. When the 'const' > is to the right side of the asterisk, then the pointer value itself > must not be changed. > > The pointer own address can't be changed, only its own content > (address of the element pointed by it) or the content of the element > pointed by it. It helps to place the const somewhat unconventionally after the type and read the type's "meaning" from right to left: typedef uint8_t byte; byte *p1; // (Non-const) ptr to (non-const) byte. // Both p1 and its target *p1 can be modified. byte const *p2; // (Non-const) ptr to const byte. // The pointer p2 can be changed, but the byte *p2 can't. byte *const p3; // Const ptr to (non-const) byte. // The pointer p3 can't be changed, but the byte *p3 can. byte const *const p4; // Const ptr to const byte. // Neither the ptr p4 nor the byte *p4 can be changed. Gerhard -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist