在PSOC中,怎样用C语言实现整型向字符型的转换

[复制链接]
3248|4
 楼主| god_like 发表于 2009-12-5 21:54 | 显示全部楼层 |阅读模式
在PSOC中,怎样用C语言实现整型向字符型的转换
love_life 发表于 2009-12-5 21:58 | 显示全部楼层
void int_str(int i,char * str)
{
int len =0;
int j;
char c;   
  while(i>0)
    {
          str[len++] = i%10 +'0';
          i= i/10;
     }
     str[len] = '\0';

     for(j=0;j<len/2;j++)
   {
      c = str[j];
      str[j] = str[len-j];
      str[len-j] = c;
    }
  
}
jxin 发表于 2009-12-5 22:18 | 显示全部楼层
void itoa(char *string, unsigned int value, int base);
is ok?
liliang9554 发表于 2009-12-5 22:56 | 显示全部楼层
2楼说的不错
riantsoul 发表于 2009-12-8 22:51 | 显示全部楼层
2楼讲的很好
您需要登录后才可以回帖 登录 | 注册

本版积分规则

34

主题

745

帖子

1

粉丝
快速回复 在线客服 返回列表 返回顶部