C language: int a = 322; printf("%c\n",a); How does C language castrate input characters that exceed the range of the ascii table

#include<stdio.h>
int main()

{
    
    
int a = 322;
char b;
b = a;
printf("%c\n",b);

return 0;
}

Insert picture description here
You can see that the result is B.
We convert 322 to hexadecimal, and the
Insert picture description here
result is 142. But char only supports two hexadecimal numbers, and the highest 1 will be castrated,
so the result of 42 compared to the ascii code table is B
Insert picture description here

Guess you like

Origin blog.csdn.net/helloworld573/article/details/105705456