0
0

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.

null文字とは何なのか、オール0ビット列とはなんなのか

Posted at

null は 0x00 もしくは \0 のようなnull文字とはどう違うのか。

型が違うだのなんだのとあるがイマイチ。

オール0ビット列のバイト配列が欲しいと考えた時、それはnullでは無いのか?

scala> val x = '\u0000'
x: Char = ?

scala> printf("%c", x)

scala> printf("%s", x)

scala> val y = null
y: Null = null

scala> printf("%c", y)
null

scala> printf("%s", y)
null

scala> val z: Byte = 0x00
x: Byte = 0
scala> printf("%c", z)

scala> printf("%s", z)
0

頭がフットーしそうだよおっっ(੭ ˃̣̣̥ ω˂̣̣̥)੭ु⁾⁾

とりあえずオール0ビット列が欲しい時にnullではだめそう。

0
0
0

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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?