Mail Archives: djgpp/1999/07/06/22:33:51
Why would the size of a pointer be 8 bytes long ? Shouldn't it be 4 bytes ?
At 10:55 PM 7/4/99 -0500, you wrote:
>> I want to create a array of size mpx by mpy.
>> After this code, sizeof(v) = 8, why ???
>>
>
>well, because v is a pointer to a pointer, and the size of any pointer is
>8 bytes. don't worry, your memory is allocated fine, it's just that since
>it is dynamically allocated, you can't use sizeof() to check how much
>memory you allocated.
>
>mark
>
>> unsigned char **v;
>> int mpx,mpy,i;
>>
>> mpx=64;
>> mpy=48;
>>
>> v = new unsigned char*[mpy];
>> for(i=0;i<mpy;i++)
>> {
>> v[i]=new unsigned char[mpx];
>> }
>>
>>
>>
>>
>>
>
>
- Raw text -