例如:
我如何实现这一目标?
答案 0 :(得分:6)
这很简单,你不需要转换任何代表问题,例如
const char *sixteen = "16";
const char *twentyfour = "24";
const char *number = "1345461";
printf("%d,%d\n", sixteen[0], sixteen[1]);
printf("%d,%d\n", twentyfour[0], twentyfour[1]);
// ^ ^ use the `%d' specifier to see the decimal value
// of the corresponding ascii.
for (int i = 0 ; number[i] != '\0' ; ++i)
printf("%d,", number[i]);