Lets say I have two pointers, both to chars:
char *ptr1;
char *ptr2;
Now lets pretend this:
ptr1 = malloc(64)
So we allocated 64 bytes, and ptr1 points to the first byte of those 64 allocated.
Now poof! I just assigned all 64 values unique byte values.
Heres my question:
if I say something like:
I'm assuming addresses are 32-bit (meaning they can be expressed in 2-bytes)Code:ptr2 = malloc(1000) // ignore the 1000, im just allocating excess bytes *ptr2 = newImage;
But what im really looking for is, I want to store the memory location (two byte wise) of the current location of newImage in *ptr2. Is this the best way to do it? I'm scared its only going to store 1 byte as opposted to the 32-bit address im looking for (since char is only 1 byte)