Pointer Crash

Here is my code:
1
2
3
4
int main(void)
{
    char* filename;
    cin>>filename;


My instructor's code looks almost exactly the same, and yet my program crashes when I enter something to define filename. I see no real difference between my code and my instructor's code, which works. Can someone explain why I'm getting a Windows dialogue crash with my program and how to fix it?
You need to have the pointer point to something. I myself would write that code like this:
1
2
char *filename=new char[256];
std::cin >>filename;
Topic archived. No new replies allowed.