単項*演算子

Last revision:2024/05/14

名称

単項*演算子

説明

デリファレンス(参照外し)は、特にポインタと一緒に使われる機構である。単項*演算子はこのために使われる。ポインタpに対して、*pはポインタpの示すアドレスの内容を示す。

使用例

1
2
3
4
5
6
int *p;       // declare a pointer to an int data type
int i = 5;
int result = 0;
p = &i;       // now 'p' contains the address of 'i'
result = *p;  // 'result' gets the value at the address pointed by 'p'
              // i.e., it gets the value of 'i' which is 5

注意

C言語を学習するうえで、ポインタは最も難しい問題の一つである。ほとんどすべてのArduinoのスケッチは、ポインタを使わずに書くことができる。しかし、ある種のデータ構造の操作にポインタを使うとコードが簡潔になるし、ツールキットの中では、ポインタ操作の知識が役にたつ。

参照

オリジナルのページ

https://docs.arduino.cc/language-reference/en/structure/pointer-access-operators/dereference/

最終更新日

July 22, 2026

inserted by FC2 system