分析整数到字符串C [英] Parsing Integer to String C

查看:101
本文介绍了分析整数到字符串C的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一个人如何解析到字符串一个整数(字符* ||的char [])用C?是否有一个相当于从Java在C 的Integer.parseInt(字符串)方法?

How does one parse an integer to string(char* || char[]) in C? Is there an equivalent to the Integer.parseInt(String) method from Java in C?

推荐答案

如果你想为一个整数转换成字符串,请尝试功能的snprintf()

If you want to convert an integer to string, try the function snprintf().

如果你想将字符串转换为整数,试试功能的sscanf()的atoi()蒂()

If you want to convert a string to an integer, try the function sscanf() or atoi() or atol().

这篇关于分析整数到字符串C的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆