I would use this to refresh my memory on C strings....
Originally Posted by kmdv
so what would be the way to fix it?
char *name and immediately initialise it to a string?
Actually, I just used the debugger in Dev C++ and it didn't work, embarrassed here
I guess i would have to
initialize the pointer on declaration either to a hard coded string or I could do this
char *name ="name" ;
And that should work.
using namespace std;
char *name ;
char _name ;
cout << "name: ";
cin >> _name ;
name = _name ;
cout << "your name is: " << name << "\n";