I have a pointer value stored at b+4 that I would like to load ‘a’ into. So essentially I have that b+4 is a pointer to a pointer to an unsigned int (the address pointed to by a). However, I was wondering whether this code would actually store the entirety of ‘a’ (since ‘a’ is 4 bytes), or if the left-hand value would just store 1 byte:
void *a = //something;
*((unsigned **)((char*)b+4)) = a;
I am confused as to whether the second line will store ‘a’ as a char, or as an unsigned int…
*edit: So then, would it be any different if I did:
*((char *)b + 4) = a;
Resolves to a pointer.
A pointer is a type which just points(stores) the address of the type(which it is declared of). Also, note that all pointers on an system will have essentially the same size.
So in this case,
The pointer at
b+4just points/stores the address whichastores.You will have two pointers pointing to the same address.
Does not resolve to a pointer type, You are trying to assign a pointer to non pointer type, So it should give a warning.