Chinaunix首页 | 论坛 | 博客
  • 博客访问: 156277
  • 博文数量: 25
  • 博客积分: 1222
  • 博客等级: 中尉
  • 技术积分: 322
  • 用 户 组: 普通用户
  • 注册时间: 2007-09-27 10:18
文章分类
文章存档

2011年(7)

2010年(9)

2009年(9)

我的朋友

分类: C/C++

2011-05-30 20:26:49

char *tohex(unsigned int x)
{
    char digits[16] = "0123456789abcdef";
    static char result[10];
    int i;
    i = 10;
    do {
        --i;
        result[i] = digits[x & 0xf];
        x >>= 4;
    } while (x != 0 && i > 0);
    result[--i] = 'x';
    result[--i] = '0';
    return &result[i];
}
阅读(1007) | 评论(0) | 转发(0) |
0

上一篇:满足适当条件的O(n)排序算法

下一篇:没有了

给主人留下些什么吧!~~