Different int sizes on my computer and Arduino

后端 未结 5 495
梦谈多话
梦谈多话 2021-01-21 07:12

Im working on a sparetime project, making some server code to an Arduino Duemilanove, but before I test this code on the controller I am testing it on my own machine (An OS X ba

5条回答
  •  孤街浪徒
    2021-01-21 07:58

    Your best bet is to use the stdint.h header. It defines typedefs that explicitly refer to the signedness and size of your variables. For example, a 16-bit unsigned integer is a uint16_t. It's part of the C99 standard, so it's available pretty much everywhere. See:

    http://en.wikipedia.org/wiki/Stdint.h

提交回复
热议问题