#include <iostream.h> int main() { int x; // A normal integer int *p; // A pointer to an integer p=&x; // Read it, "assign the address of x to p" cin>> x; // put a value in x, we could also use *p here cin.ignore(); cout<< *p <<"\n"; // Note the use of the * to get the value cin.get(); }
It is important to get basic information about C++ programming to learn more about programming language. The given example of pointer function in C++ programming is good to understand about basic code of pointer. Here return value not given so, it may show error. You can solve it by “Return 0;†code at last line before bracket completed.