0

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 #includes:

  • sys/socket.h
  • netinet/in.h
  • arpa/inet.h
  • stdio.h
  • stdlib.h
  • string.h
  • strings.h
ApprenticeHacker
  • 21,351
  • 27
  • 103
  • 153
ruhungry
  • 4,506
  • 20
  • 54
  • 98

3 Answers3

4

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.

Ken Wayne VanderLinde
  • 18,915
  • 3
  • 47
  • 72
  • 4
    Also note that `atoi` is not useful if your goal is to ensure that the 32-bit numbers can be read (`int` could be smaller than 32 bit). In that case you'd need `strtol` or `sscanf` with the `SCNd32` macro from `inttypes.h`. – R.. GitHub STOP HELPING ICE Mar 21 '12 at 15:00
2

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");
ApprenticeHacker
  • 21,351
  • 27
  • 103
  • 153
-1

If you want Int32 variable you should use

<arm.h>

Check this link. http://pubs.opengroup.org/onlinepubs/009619299/apdxa.htm

Teja
  • 13,214
  • 36
  • 93
  • 155