实际上, 在不久前, 我聊过这个, 为了再次强调(因为踩了坑, 浪费0.5小时), 故再次来玩一遍:

#include <iostream>
using namespace std;

int main()
{
	char c1 = -1;
	printf("%02x\n", c1); // ffffffff

	char c2 = 250;
	printf("%02x\n", c2); // fffffffa

	printf("heheda\n");

	unsigned char c3 = -1;
	printf("%02x\n", c3); // ff

	unsigned char c4 = 250;
	printf("%02x\n", c4); // fa

    return 0;  
}
      呵呵哒。






本文转载:CSDN博客