Im not sure I understand when i can actually assign using the post-fix pointer way. Did this example for making sure i
m not miss anything
(last row does not work, is it work on class only example? ) .
#include <iostream>
#include <string>
///This simple cpp just demostrate pointers and refernces Barakooda, 09\11\16.
int main()
{
//lets create variable int type called mooki and give it a value of 101.
int mooki = 101;
//lets create pointer called someone.
int *someone;
//someone will be pointer to the address of mooki.
someone = &mooki;
//lets print mooki address in two ways .
std::cout << "Mooki Adress is " << someone << std::endl;
std::cout << "Mooki Adress is " << &mooki << std::endl << std::endl;
//lets print mooki value in two ways.
std::cout << "Mooki value is " << mooki << std::endl;
std::cout << "Mooki value is " << *someone << std::endl << std::endl;
//lets add the refernce to mooki
int &refernce = mooki;
std::cout << "refernce value is " << refernce << std::endl;
std::cout << "refernce adress is " << &refernce << std::endl << std::endl;
//lets change refernce value (point to mooki)
refernce = 102;
std::cout << "refernce value is " << refernce << std::endl;
std::cout << "Mooki value is " << mooki << std::endl << std::endl;
//lets try and save the pointer of variable mooki (postfix).
int *postfixExample ;
//doesnt work
postfixExample = mooki*;
}