[Solved] confusing sizeof operator result

[ad_1] if I count correctly, part 1 is 9 byte long right ? No, you are counting incorrectly. 0x0200000001 can fit into five bytes. One byte is represented by two hex digits. Hence, the bytes are 02 00 00 00 01. 1 [ad_2] solved confusing sizeof operator result

[Solved] why using sizeof in malloc?

[ad_1] sizeof doesn’t return the size of the memory block that was allocated (C does NOT have a standard way to get that information); it returns the size of the operand based on the operand’s type. Since your pointer is of type struct A*, the sizeof operand is of type struct A, so sizeof always … Read more