Question about reading strings

New to programming but I kinda got the basics. But my question is about character arrays. In this statment:
{
char name[21]

cout << "what is your name? ";
cin >> name;
cout << "Good morning " << name << endl;
etc.

I really dont see the purpose of char name[21] other than telling how many characters u can use. Wouldnt defining name be easier or am I missing something here?

also is there a way to link these forums to a mobile device?

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories