qfedu-c-level/day4/homework/h12.c

11 lines
311 B
C
Raw Permalink Normal View History

2023-07-08 16:27:14 +08:00
// 请编程, 定义char类型的变量n初始化值为-128, 将n值减1之后再输出它的十六进制数值和十进制数值
#include <stdio.h>
int main()
{
char n = -128;
n -= 1;
printf("十六进制数值为: 0x%hhx\n", n);
printf("十进制数值为: %d\n", n);
return 0;
}