I'm a beginner trying to get the concept of pointers
Why won't this compile?
[code]
#include <iostream>
#include <stdio.h>
#include <conio.h> /* for getch() */
using namespace std;
int main()
{
int x;
int *pointer; // Declares pointer
cout<<"enter a # for x ";
cin>>x; //Reads in x
cin=*pointer; //Declares a pointer to x
pointer=&x; //Read it, "pointer equals the address of x"
cout<<*pointer; //Note the use of the * to output the actual number stored in x
getch();
return 0;
}
[code/]
gets an error at cin = *pointer;
saying that pointer is undeclared........??
Thanks for any input........