c - 如何使用 atoi() 将类型转换为 Int32

标签 c casting atoi int32

我有一段C代码:

Int32 tmp = atoi("314");

它抛出一个错误:

error: Int32 undeclared (first use in this function)

我不知道为什么?你能帮帮我吗?

可能是 #include 的问题:

  • sys/socket.h
  • netinet/in.h
  • arpa/inet.h
  • stdio.h
  • stdlib.h
  • string.h
  • strings.h

最佳答案

没有称为Int32 的标准类型.您可能正在寻找

int tmp = atoi("314");

如果需要32位整数,标准类型是int32_tinttypes.h 中定义或 stdint.h .

关于c - 如何使用 atoi() 将类型转换为 Int32,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9806570/

相关文章:

arrays - PowerShell:为什么一个参数上的 [Parameter(Mandatory = $True)] 会影响另一个参数的类型转换行为?

c++ - 在 C++ 中使用 atof 将字符串转换为十进制不起作用

c - 空指针赋值错误!

在此 C 编程案例中,C99 命令行不打印任何内容

java - 向 Java 类库添加函数

c++ - 冰淇淋店的字符串程序(再次编辑)

string - strconv.Atoi() 给定字符串时抛出错误

c - 了解 C 中 read() 和 lseek() 的功能

c - 系统小程序 : Assertion

c# - 将成员访问函数从 Func<DerivedFromT,object> 转换为 Func<T,object>