我有一段 C 代码:
Int32 tmp = atoi("314");
它抛出一个错误:
error: Int32 undeclared (first use in this function)
我不知道为什么?你可以帮帮我吗?
可能是#includes 的问题:
sys/socket.hnetinet/in.harpa/inet.hstdio.hstdlib.hstring.hstrings.h
没有标准类型称为Int32. 您可能正在寻找
int tmp = atoi("314");
如果需要 32 位整数,标准类型在or中int32_t定义。inttypes.hstdint.h
C中没有内置Int32类型。您可以包含stdint.hforint32_t和uint32_tthough。但在这种情况下,您可能想要使用int.
int tmp = atoi("314");