How does the equal sign work in C language?

unsigned char CPM 1;

-1 is a constant stored according to the int type. C is printed directly. The last byte of the complement mode of-1 is copied directly to c. Is the equal sign of c language copied directly bit by bit? When you assign a constant to a variable, will you first transform the constant into a type that matches the variable before assigning it?

CPP c
Feb.26,2021

ISO C standard says

6.3.1.3 Signed and unsigned integers

When a value with integer type is converted to another integer type
other than _ Bool, if the value can be represented by the new type, it
is unchanged. Otherwise, if the new type is unsigned, the value is
converted by repeatedly adding or subtracting one more than the
maximum value that can be represented in the new type until the value
is in the range of the new type. Otherwise, the new type is signed and
the value cannot be represented in it; either the result is
implementation-defined or an implementation-defined signal is raised.

in other words, the representation range of, unsigned char is [0,255], which cannot be expressed as-1, so add-1 to 256 to get 255.

if you convert signed char-1 to unsigned int, use-1 plus 4294967296 to get 4294967295.

for hardware, the conversion from signed to unsigned is simply padding symbol bits in front of them or truncating directly.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e71ef4-398.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e71ef4-398.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?