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.

Cのconstでの関数引数制限

0
Posted at

完全に備忘録

以下の記事で詳しく説明されています。

図解:constとポインタと参照
変数の const 付け方一覧

結局何?

ポインタ(メモリ参照位置)を変更禁止にするか、中身の数値(メモリ参照位置に入っている値)です。
自分で組み込みするときはこれを使うと意図せぬ上書きとかのエラー回避に使えそうなのでしっかり覚えたいところ。

ついでにポインタの覚えてること

ポインタに関して覚えてることも記載します。

  • 変数は数値変数とポインタ変数の2種類がある
    • 基本的に数値として扱う目的、アドレスを示す役割に分かれている。というか分けて考えた方が考えやすいです。
    • *,&はキャストみたいなもの。
  • int* p
    • ポインタ(アドレス本体)p
    • 数値(アドレスの中身)*p
    • ポインタの使い方の基本はアドレス位置を示すので*がついていると数値として扱う
  • int p
    • ポインタ(アドレス本体)&p
    • 数値(アドレスの中身)p
    • 主目的が数値を扱う変数。&がついているとポインタとして扱える
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?