For example:
- "16" should print out the decimal values: 49,54
- "24" should print out the decimal values: 50,52
How do I achieve this?
For example:
How do I achieve this?
It's really simple, you don't need to convert anything it's a matter of representation, example
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]);