编写函数实现:整型数转换成字符串
来源:互联网 发布:算法导论高清视频下载 编辑:程序博客网 时间:2024/05/17 22:38
#include "stdio.h"#include "stdlib.h"#include "string.h"void int_to_str(unsigned int src,unsigned char* dest);void main(void){unsigned int num = 0;unsigned char str[11] = {0};printf("scanf a number:\n");scanf("%d",&num);int_to_str(num,str);printf("after convert: %s\n",str);}void int_to_str(unsigned int src,unsigned char* dest){char pos = 0;char len = 0;if(NULL == dest)return ;do{dest[pos++] = src % 10 + '0';}while(src /= 10);dest[pos] = '\0';len = strlen((const char*)dest);for(pos = 0;pos < len/2;pos++){dest[pos] += dest[len-pos-1];dest[len-pos-1] = dest[pos]-dest[len-pos-1];dest[pos] -= dest[len-pos-1];}}
- 编写函数实现:整型数转换成字符串
- 函数实现键盘输入整型数,将其转换成字符串输出。123456789 "123456789"
- atoi() -- 将字符串转换成整型数
- 将整型数转换成字符串
- atoi 把字符串转换成整型数
- 自写字符串转换成整型函数
- 递归法实现整型数到字符串的转换
- 递归法实现整型数到字符串的转换
- 将一个字符串转换为整型数的实现
- 整型数组处理算法(十四)不用库函数,用C语言实现将一整型数转换成字符串
- C语言strtoul()函数:将字符串转换成unsigned long(无符号长整型数)
- strtoul函数的使用(将字符串转换成无符号长整型数)
- C语言strtol()函数:将字符串转换成long(长整型数)
- C语言strtol()函数:将字符串转换成long(长整型数)
- 库函数atoi的C语言实现---------将字符串的数字符转换成整型的数字
- 整型转换成字符串
- 字符串转换成整型
- 字符串转换成整型
- 2012.12.15
- 使用tcpdump抓包
- BOOTLOADER 之我见
- Linux 学习笔记(六)添加用户
- 120941138报:ICEmobile 1.2.0 发布,手机 Web 开发框架
- 编写函数实现:整型数转换成字符串
- [Android]仿Windows Phone的启动器,无广告
- Win7下如何解决IE引起的花屏
- 120941138报:Neo4j 1.9.M2 发布,面向网络的数据库
- 迫不及待的和大家分享iOS下的正则表达式类库的心得!
- PhotoShop -------填充背景
- 游戏类型分类
- Ad hoc query
- 120941138报:HTML5 的明天, 局部有小雨