+ 8
What is the difference from string and char on c++??
Explanation about string and char
4 Answers
+ 8
A string is a collection of characters, specified within double-quotes. An example of a string literal:
"This is a string"
which can then be stored in a string variable:
std:: string str = "This is a string";
A character is just, a character, within single-quotes.
'c'
' ' // whitespace character
'\n' // newline character
char c = 'c';
+ 6
Can i ask.. Do i need insert "std::" every time when i am making some string and what exactly the function is...??
ā®(Ā°_Ā°)ā
+ 5
std:: is to specify the standard namespace. You can do
using namespace std;
to omit the namespace before invoking objects from the std namespace, e.g. cout, instead of std::cout, string instead of std::string, etc.
That said:
https://www.sololearn.com/discuss/294730/?ref=app
+ 4
array of characters is called string
char a='c'; //char
char a[10]="abcadhjkkkggh"; //string