-
Chars
I have a problem. I isolated it to two lines.
Code:
char *aMenuChoice;
cin>>aMenuChoice;
My problem, a runtime error. It is- The variable 'aMenuChoice' is being used without being defined.
And we know it is.
and then later I get this when I enter something and hit the key enter:
Unhandled exception at 0x0041441f in Classes.exe: 0xC0000005: Access violation writing location 0xcccccccc.
What's my problem?
-
your variable is declared as a pointer
and it is pointing to un-allocated memory...
this is the thing that crashes your program
it must be either
char choise;
cin>>choise;
OR
char *choise = new char[200];//string
cin>> choise; //assign something to the string
-