where type is the data type of the value that the pointer is intended to point to. This type is not the type of the pointer itself! but the type of the data the pointer points to. For example:
1 2 3
int * number;
char * character;
float * greatnumber;
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
// my first pointer
#include <iostream>
usingnamespace std;
int main ()
{
int firstvalue, secondvalue;
int * mypointer;
mypointer = &firstvalue;
*mypointer = 10;
mypointer = &secondvalue;
*mypointer = 20;
cout << "firstvalue is " << firstvalue << endl;
cout << "secondvalue is " << secondvalue << endl;
return 0;
}