Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Ethan

locate Structurs

This topic is 6089 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement
I''m not sure what you mean, but I''m going to make a guess:

  
MyStruct mystruct;
void *pEndOfMyStruct = (void *)(&mystruct + sizeof(MyStruct));


pEndOfMyStruct will be pointing the memory location directly after the end of mystruct.


codeka.com - Just click it.

Share this post


Link to post
Share on other sites
Sorry Dean Harding, but your code doesn't do what you think. it adds sizeof (MyStruct) * sizeof (MyStruct) bytes to the base address.
The correct version could look like the following:
  
MyStruct mystruct;
void *pEndOfMyStruct = &mystruct + 1;


Edited by - VolkerG on September 23, 2001 6:16:00 AM

Share this post


Link to post
Share on other sites
Yeah, you''re right, sorry. It should read:

  
MyStruct mystruct;
void *pEndOfMyStruct = (char *)&mystruct + sizeof(MyStruct);


Of course, your method works, too. And it''s probably clearer what''s happening, too...


codeka.com - Just click it.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!