Skip to content

Instantly share code, notes, and snippets.

@fereria
Created February 15, 2020 12:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fereria/a53547de7d1f61b221fd80d00a4a8483 to your computer and use it in GitHub Desktop.
Save fereria/a53547de7d1f61b221fd80d00a4a8483 to your computer and use it in GitHub Desktop.
#include <iostream>
using namespace std;
void pointerTest_01()
{
int hoge = 10;
int& refHoge = hoge; // hogのの参照
int* pHoge = &hoge; // 初期化
refHoge = 20;
cout << pHoge << endl; // pHogeのアドレス
cout << *pHoge << endl; // pHogeの実体
cout << hoge << endl; // pHoge
cout << &refHoge << endl;
cout << refHoge << endl; // 参照
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment