Answers for "string to hexadecimal in c"

C++
0

string to hexadecimal in c

char hex[] = "6A";                          // here is the hex string
int num = (int)strtol(hex, NULL, 16);       // number base 16
printf("%cn", num);                        // print it as a char
printf("%dn", num);                        // print it as decimal
printf("%Xn", num);                        // print it back as hex
Posted by: Guest on December-23-2021

Code answers related to "string to hexadecimal in c"

Browse Popular Code Answers by Language