I am getting an error 199 "left side of '->' requires a struct/union pointer. I'm not entirely sure why. Maybe it's obvious, but I've been looking at this code for too long:
struct test_struct { U8 blah; U16 more_blah; }; // Here's an array of these struct test_struct example[2] = { { 1, 2 }, { 3, 4 } }; // Now I just want to point to these struct test_struct * p[2]; // Somewhere they get initialized ... p[0] = &example[0]; p[1] = &example[1]; ... // Later I want to use the pointers: U8 i; U16 j; i = p[0]->blah; j = p[0]->more_blah;
Never mind. It was one of those cases where the error message points you to the wrong line of code. There was an error prior to that block of code. Nothing related to the pointers.
I couldn't see anything wrong with the code you posted so I compiled it. Guess what.. no errors, no warnings.