LoginSignup
2
1

More than 5 years have passed since last update.

C/C++言語の細かい事

Last updated at Posted at 2019-04-24

constと定数について

constはreadonlyの意味。書き換え不可能であることを示します。

しかしCコンパイラには細かい仕様があります。
それは、int型に関しては定数として解釈してよいというものです。

サンプル
const int value1; // intに関しては定数最適化解釈をしてもよい
const float value2; // readonlyでしかない。定数ではない

ファイルローカルリンケージ

翻訳単位毎に別の変数と解釈する。
const は externは付かない


続く。。。

2
1
5

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
2
1