uint8_t ct2[5] = {0xFC,0xAD,0x71,0x5B,0xD7};
char str[5] = {0};
for(i=0;i<5;i++){
printf("%.2X",ct2[i]);
}
printf("\n");
for(i=0;i<5;i++){
sprintf(str+2*i,"%.2X",ct2[i]);
}
for(i=0;i<5;i++){
printf("%.2X",ct2[i]);
}
printf("\n");
printf("%s\n",str);
The above code prints the ct2 array before and after the sprintf function is executed, and they have different values. I wonder why?
0 Answer
No answer yet
这家伙很懒,什么都没留下...