Archived

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

dreddlox

&pImage->sizeY == 0 even if &pImage + 4 points to the sizeY variable in pImage

Recommended Posts

How do I find the address of the element ''sizeY'' in the struct pImage in C++? I tried &pImage->sizeY and it compiled right, but memory violations and the debugger says it points to 0x00000000

Share this post


Link to post
Share on other sites
And what address does pImage point to? If you have memory violations with that code I assume you haven''t allocated memory for pImage or pImage is pointing to something it shouldn''t be pointing to.

Share this post


Link to post
Share on other sites
Redemption: the pImage pointer is fine, properly allocated with new or malloc(depending on how well my day is going), so my makeshite solution was &pImage + 4(as there was 1 int between &pImage and &sizeY)

LessBread: Thanks, it worked :-)

Share this post


Link to post
Share on other sites