Skip to content

Commit

Permalink
article: add more information to the old post
Browse files Browse the repository at this point in the history
  • Loading branch information
macrat committed Apr 27, 2024
1 parent 6243b7b commit 221d2ca
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pages/blog/2013/04/what-is-uint16.md
@@ -1,15 +1,18 @@
---
title: C言語のu_int16とかって何なのよ。
pubtime: 2013-04-28T02:25:00+09:00
modtime: 2024-04-27T23:59:00+09:00
modtime: 2024-04-28T00:04:00+09:00
tags: [C言語]
description: C言語のint8やu_int16といった型の意味とサイズ、最大値と最小値のまとめです。
---

Unix向けに書かれたC言語のプログラムで見る`u_int8`や、`u_int16``u_int32`って型は何なのか。というお話。
そんな検索ワードで来てくださった方が居たようなので。

`u_int16`とは、`unsigned int`の16ビットを示します。
たとえば`u_int16`の場合、最初の`u_`**unsigned**であること = 0未満を扱わないことを、最後の`16`**16bit**分のサイズがあることを示しています。
`u_`を外して**signed**になってマイナスを扱えるようになりますし、`16`の代わりに`8``32`にすると格納できる容量が変わります。

似たような型を並べてみると以下のようになります。

| 名前 | 別名 | サイズ | 最小値 | 最大値 |
|------------------------|-------------------------------------|----------:|---------------------------:|---------------------------:|
Expand Down

0 comments on commit 221d2ca

Please sign in to comment.