char str[10]="153";
字符串如何转化为16进制数
你可以先用atio函数转化成十进制数字,再用个循环转化成16进制。
#include <stdlib.h>
#include <stdio.h>
int main(int argc, char* argv[])
{
char str[10]="153";
int n = atoi(str);
itoa(n, str, 16);
printf("%s", str);
return 0;
}
99Press any key to continue