#include <stdio.h>

static char *_toHex(char *buf, unsigned int x){
    if (15 < x) buf = _toHex(buf, x >> 4);
    x &= 15;
    *buf = (x<10 ? '0'+x : 'A'+x-10);
    return buf+1;
}

char *toHex1(char *buf, unsigned int x){
    *_toHex(buf, x) = '\0';
    return buf;
}

char *toHex2(unsigned int x){
    static char buf[9];
    return toHex1(buf, x);
}

unsigned int toInt(const char *buf){
    unsigned int x = 0;
    for(; *buf; buf++) x = x*10 + *buf - '0';
    return x;
}

int main(int argc, char *argv[]){
    return 1<argc ? puts(toHex2(toInt(argv[1]))) : puts("give me a number.");
}

一度整数型にしてるという卑怯さ加減の凄さはもはや芸術的(;´ー`)
toHex2 はスレッドセーフですらないっ