Hey everyone,
I typed out some simple code and it confused me:
How am I able to cin into name? Am I wrong in thinking that name points to an array? This was just a quick question in my head... what exactly is taking place in the line:Code:#include <iostream> using namespace std; main() { char* name = new char[80]; cout << "Enter a name: "; cin >> name; cout << "name is " << name << endl; }
Thanks!Code:char* name = new char[80];
Just to add in a bit extra....if name is a pointer, shouldn't I have to use *name to cin to? And also *name to cout?