I need to print the address of a pointer. This is my code:
float arr[5] = {1.2 , 2.3 , 5 , 7.1 , 9.6};
float *ptrarr;
ptrarr = &arr[0];
printf("Address of ptrarr+2=%p,%p \n\n",ptrarr+2,&arr[2]);
I knew that pointer addresses have 8 bytes, but my output is always 16 bytes. This is the output
Address od ptarr+2=000000000061FDE8,000000000061FDE8
Can someone please explain?
On a platform where the number of bits per byte is 8:
1 hexadecimal character represents 4 bits, i.e., "half a byte".
Hence 16 hexadecimal characters represent 8 bytes (not 16 bytes).
Note that generally, the number of bits per byte is define by CHAR_BIT
.
So on the theoretical aspect, a byte can consist of something other than 8 bits.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With