C++ ညွှန်ပြချက်များကို ပြင်ဆင်ပါ။
Pointer Value ကို ပြင်ဆင်ပါ။
pointer ၏တန်ဖိုးကိုလည်းသင်ပြောင်းနိုင်သည်။ သို့သော် ၎င်းသည် မူရင်းကိန်းရှင်၏တန်ဖိုးကိုလည်း ပြောင်းလဲမည်ဖြစ်ကြောင်း သတိပြုပါ။
ဥပမာ
string food = "Pizza";
string* ptr = &food;
// Output the value
of food (Pizza)
cout << food << "\n";
// Output the memory address
of food (0x6dfed4)
cout << &food << "\n";
// Access the memory
address of food and output its value (Pizza)
cout << *ptr << "\n";
// Change the value of the pointer
*ptr = "Hamburger";
//
Output the new value of the pointer (Hamburger)
cout << *ptr << "\n";
//
Output the new value of the food variable (Hamburger)
cout << food << "\n";