%x prints the hex representation of the value of the given argument. The two's complement representation of -1, in hex, gives you that ffffffff.

FWIW: This outcome is not particularly related to use of bit-filed variable here, as printf() is a variadic function.

% x打印给定参数值的十六进制表示形式。二的补码表示1，十六进制，给你ffffffff。

总的来说：这一结果是不使用这里的位场变量是相关的，因为printf()是一个可变参数函数。

answer2：

回答2：

When you pass your bit field to printf, a function with variable number of arguments, the value undergoes a conversion to int. Even though the value has only two bits, its binary value of 11 means -1 in two's complement representation, so the value gets sign-extended into an integer -1 when it is sent to printf. This is 0xffffffff in hex representation on 32-bit systems.

If you would like to see only two bits printed as hex, make your bit field unsigned. This will ensure that no sign extension would be performed before printing:

This has nothing to do with bit fields as such. It happens because of an obscure rule in C called the default argument promotions:

If the expression that denotes the called function has a type that
does not include a prototype, the integer promotions are performed on
each argument, and arguments that have type float are promoted to
double. These are called the default argument promotions.

(Emphasis mine) And this rule also applies to variadic functions like printf:

The ellipsis notation in a function prototype declarator causes
argument type conversion to stop after the last declared parameter.
The default argument promotions are performed on trailing arguments.

So your bit field is integer promoted to type int before printf even starts interpreting it. The sign is preserved, so what you are seeing is the hex representation of a two's complement int containing the value -1.

As a side note, I would not recommend you to use bit fields at all, as their behavior is poorly specified and they are completely non-portable. See this.

这与位字段无关。这是因为C中的一个模糊规则称为默认参数促销：

If the expression that denotes the called function has a type that
does not include a prototype, the integer promotions are performed on
each argument, and arguments that have type float are promoted to
double. These are called the default argument promotions.

（重点），这个规则同样适用于复杂的功能如printf：

The ellipsis notation in a function prototype declarator causes
argument type conversion to stop after the last declared parameter.
The default argument promotions are performed on trailing arguments.