C++ Strings single chars
I've just started learning C++ and im kinda confused about strings. I
first need a input word and save every single char in the certain position
of a char-Array. But strings are basically char-Arrays, aren't they? But
this does not work:
char word[];
cin >> word[];
Whereas this works but I dont know how to fill the chars into an Array.
string s;
cin >> s;
I've tried this so far, but i got an compile error:
string s;
cin >> s;
char word[] = s;
I'm sorry, I've just started programming and I wonder if anyone has some
advice for me :)
No comments:
Post a Comment