How to convert int to hexadecimal string in C

1 Answer

0 votes
#include <stdio.h>

int main(void) {
    int n = 31329;
    char hex[5] = "";

    sprintf(hex, "%X", n);
    
    puts(hex);
    
    return 0;
}





/*
run:

7A61

*/

 



answered Sep 18, 2021 by avibootz

Related questions

2 answers 284 views
1 answer 185 views
185 views asked Sep 18, 2021 by avibootz
1 answer 189 views
1 answer 218 views
1 answer 191 views
3 answers 275 views
...