How to Declare a 32-bit Integer in C

前端 未结 9 2262
日久生厌
日久生厌 2020-12-05 03:53

What\'s the best way to declare an integer type which is always 4 byte on any platforms? I don\'t worry about certain device or old machines which has 16-bit int

9条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-05 04:18

    stdint.h is the obvious choice, but it's not necessarily available.

    If you're using a portable library, it's possible that it already provides portable fixed-width integers. For example, SDL has Sint32 (S is for “signed”), and GLib has gint32.

提交回复
热议问题