Implementations might differ between the actual sizes of types, but on most, types like unsigned int and float are always 4 bytes. But why does a type always occupy a certai
It can be less. Consider the function:
int foo() { int bar = 1; int baz = 42; return bar+baz; }
it compiles to assembly code (g++, x64, details stripped)
$43, %eax ret
Here, bar and baz end up using zero bytes to represent.
bar
baz