Chinaunix首页 | 论坛 | 博客
  • 博客访问: 363732
  • 博文数量: 84
  • 博客积分: 1970
  • 博客等级: 上尉
  • 技术积分: 970
  • 用 户 组: 普通用户
  • 注册时间: 2008-04-13 20:42
文章分类
文章存档

2011年(1)

2010年(4)

2009年(29)

2008年(50)

我的朋友

分类: C/C++

2008-09-08 11:42:42

函数名: atoi
功  能: 把字符串转换成长整型数
用  法: int atoi(const char *nptr);
程序例:
#include
#include

int main(void)
{
   int n;
   char *str = "12345.67";

   n = atoi(str);
   printf("string = %s integer = %d/n", str, n);
   return 0;
}

----------------------------------------------------------

功能:将字符型变量转换成整数型.
原形:int x=atoi(char y)

例:

#include
#include

using namespace std;
void main()
{
 char *a=”123″;

阅读(3322) | 评论(0) | 转发(0) |
0

上一篇:c函数: strtok 和 strtok_r

下一篇:c函数:getcwd

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