Int2str
char* num2str(int num, char *str)
{
    char *c, *c2;
    for (c = str; num; num/=10, c++)
        *c = num % 10 + '0';
    *c = '\0';
    c2 = c - 1;
    c = str;
    while (c < c2) {
        *c ^= *c2;                     // swap *c and *c2
        *c2 ^= *c;
        *c++ ^= *c2--;
    }
    return str;
}
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License