Implementing space allocated for a character array
I hope the title did a decent job of summarizing my issue. I am trying to extend a two dimensional algorithm to a 3 dimensional solution, and am having some trouble storing my slice files. I have an image object I, which has a member pt that is a pointer to an array of unsigned chars. My code looks like this:
Code:
istream& operator>>(istream& is, Image& I)
{
if(I.pt) {
cout << "test\n";
delete [] I.pt;
I.width = 0;
I.height = 0;
}
.
.
.
// Now we are ready to read the data
I.pt = new unsigned char [I.getDataSize()];
I.pt[1000] = (unsigned char)1;
cout << I.pt[1000] << endl;
cout << sizeof(I.pt) / sizeof(unsigned char) << endl;
cout << I.getDataSize() << endl;
cout << sizeof(I.pt) << endl;
cout << sizeof(unsigned char) << endl;
and, my output is:
This is some pointless code that I am displaying hoping to resolve a larger issue. I am expecting to see:
Code:
1
94633984
94633984
94633984
1
What am I not understanding about the size of space pointed to by I.pt after the new statement?