I'm having an issue determining the appropriate dereferencing method to get the address of a pointer contained inside of a structure. Pointers were never my strong point. The structure might look like this:
Code:
struct myStruct {
void* myPtr;
int somecount;
};
Now the issue is that I am attempting to access a linked list that acts like an imprint of some data. So the access is like:
Code:
struct myStruct* myList;
struct myStruct* mySearch;
void* somePtr=/*assigned some address */
// create the link list with myList and fill as appropriate
mySearch=&myList;
while( mySearch != NULL ) {
// now here is where my problem is...
// how would you 'word' this... if( mySearch->(&myPtr) == &somePtr ) { ???
else { mySearch=mySearch->n; }
}
Maybe I have it right, I'm not entirely sure. The code isn't at a stage I can test it, but due to my lack in strength with pointers I figured if it was going to strike it will be with a line exactly like this. I tried searching the web, but all I got were tutorials on pointers. None of which decided to even glance at a use of pointers like this. Incase the line isn't self-explanatory (like I think it is lol) its intended to compare two pointer addresses to make sure they are pointing to the same "chunk", the problem of course being that one is sitting inside of a pointer to a structure. The use of '&' and other similar pointer accesses in conjunction with structure referencing with -> and ., if any of you happen to have a good link for this please share Would be greatly appreciated.