MS Visual C++ 6.0 bug?
I am finding that adding or subtracting "one" to a pointer is actually adding the number of bytes that is allocated to the pointer type. To find the next value in memory, I thought I should add the number of bytes to the pointer:
//should be next variable in memory?
pointer = pointer + sizeof(pointer);
but that was skipping over data. I found when I add "one":
pointer++; //this works, but shouldn't?
then I got the data I wanted (in this case, 8 bytes forward).
This should display the memory address of one array element, and then you'll see that the next output is 8 bytes more.
Maybe this is supposed to be the way it works, but I don't think so...
m_pValue = & m_dValue;
//this shows address "6618360" on my PC
//this shows address "6618368" on my PC
...beginning to see how that works. Thanks for the good "google" key :)
check the faq to see why void main is wrong
If you are just learning C or C++ languages, VC++ 6.0 is NOT a good compiler to use because it does not support many of the current ISO standards -- it is a very very old compiler. A better compiler to use for learning is Dev-C++ which you can download free at www.bloodshet.net. But it too is not fully standard compliant.