アドレス演算子 (&) と間接演算子 (*) のさまざまな書き方を見てきました。
私が間違っていなければ、次のようになります。
//examples
int var = 5;
int *pVar = var;
cout << var << endl; //this prints the value of var which is 5
cout << &var << endl; //this should print the memory address of var
cout << *&var << endl; //this should print the value at the memory address of var
cout << *pVar << endl; //this should print the value in whatever the pointer is pointing to
cout << &*var << endl; //I've heard that this would cancel the two out
たとえば、2 つの間にスペースを入れて&var
asと書いたらどうなるでしょうか。& var
私が見た一般的な構文: char* line = var;
、char * line = var;
、およびchar *line = var;
.