摘要:
#include #include int main () { char buf[10] = {0}; sprintf(buf,"%02x",-3); printf("%s\r\n",buf); char buf2[10] = {0}; sprintf(buf2,"%02x",(unsigned char)-3); printf("%s\r\n",buf2); return 1 ; }这是在云风的博客上看到的,前者输出ffffffd后者输出fd如果前者的buf空间小一点就会溢出 阅读全文