40
20

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

C/C++とC#の整数型比較表

Posted at

**"C#の整数型はC/C++とは異なるよ"**って話。

比較表

bit数 符号 C C++ C#
8 なし uint8_t std::uint8_t byte
8 あり int8_t std::int8_t sbyte
16 なし uint16_t std::uint16_t ushort
16 あり int16_t std::int16_t short
32 なし uint32_t std::uint32_t uint
32 あり int32_t std::int32_t int
64 なし uint64_t std::uint64_t ulong
64 あり int64_t std::int64_t long
8以上 なし unsigned char unsigned char
8以上 あり signed char signed char
16以上 なし unsigned short unsigned short
16以上 あり short short
16以上 なし unsigned int unsigned int
16以上 あり int int
32以上 なし unsigned long unsigned long
32以上 あり long long
64以上 なし unsigned long long unsigned long long
64以上 あり long long long long
C の long long型はC99以降
C の [u]intX_t型はC99以降 (ヘッダーは<stdint.h>)
C++ の long long型はC++11以降
C++ の std::[u]intX_t型はC++11以降 (ヘッダーは<cstdint>)

short/int/long等の整数型はC/C++とC#では定義が違うことがわかりました。

40
20
9

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
40
20

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?