我在 C 中的基本概念方面遇到了一些挑战。非常有必要提供帮助。我继续并用代码的解释以及我试图在那里提出的问题对代码进行了注释。
void main (void)
{
printf("%x", (unsigned)((char) (0x0FF))); //I want to store just 0xFF;
/* Purpose of the next if-statement is to check if the unsigned char which is 255
* be the same as the unsigned int which is also 255. How come the console doesn't print
* out "sup"? Ideally it is supposed to print "sup" since 0xFF==0x000000FF.
*/
if(((unsigned)(char) (0x0FF))==((int)(0x000000FF)))
printf("%s","sup");
}
谢谢您的帮助。