c out pointers code example
Example: c++ pointers
// my first pointer
#include <iostream>
using namespace std;
int main ()
{
int firstvalue, secondvalue;
int * mypointer; //creates pointer variable of type int
mypointer = &firstvalue;
*mypointer = 10;
mypointer = &secondvalue;
*mypointer = 20;
cout << "firstvalue is " << firstvalue << '\n'; //firstvalue is 10
cout << "secondvalue is " << secondvalue << '\n'; //secondvalue is 20
return 0;
}