C / C ++ atoi()函数教程–将字符串转换为整数

C and C++ programming languages provide string or character to integer conversion with the atoi() function. atoi simply the short form of chArTOInteger where the uppercase letters stand side by side. The function is provided by the standard library which means we do not need to install an extra library or package.

C和C ++编程语言使用atoi()函数提供字符串或字符到整数的转换。 atoi只是chArTOInteger的缩写,大写字母并排放置。 该功能由标准库提供,这意味着我们不需要安装额外的库或软件包。

atoi()函数语法 (atoi() Function Syntax)

atoi() function has a very simple syntax.

atoi()函数的语法非常简单。

int atoi (const char * str);
  • int integer type which is the type of returned value.

    int整数类型,它是返回值的类型。

  • const char * is a constant char array that is equal to a string whose variable name is str.

    const char *是一个常量char数组,它等于一个变量名称为str

在C中包含标头 (Include Header In C)

atoi function is provided from the standard library which provides basic and popular functions for application development. So in order to use atoi() function stdlib.h the header should be included as below.

标准库提供了atoi函数,该函数提供了应用程序开发的基本功能和常用功能。 因此,为了使用atoi()函数stdlib.h,标题应如下所示。

#include 

在C ++中包含标头 (

你可能感兴趣的:(字符串,c++,python,javascript,java,ViewUI)