How cast type int with atoi() to Int32
質問
I've got a piece of C code:
Int32 tmp = atoi("314");
It throws an error:
error: Int32 undeclared (first use in this function)
I have no idea why? Could you help me?
Maybe it is problem with #include
s:
sys/socket.h
netinet/in.h
arpa/inet.h
stdio.h
stdlib.h
string.h
strings.h
解決
There is no standard type called Int32
. You're probably looking for
int tmp = atoi("314");
If you need a 32-bit integer, the standard type is int32_t
defined in inttypes.h
or stdint.h
.
他のヒント
There is no built-in Int32
type in C. You can include stdint.h
for int32_t
and uint32_t
though. But in this case, you probably want to use int
.
int tmp = atoi("314");
If you want Int32 variable you should use
<arm.h>
Check this link. http://pubs.opengroup.org/onlinepubs/009619299/apdxa.htm
所属していません StackOverflow