When should I use single quotes and double quotes in C or C++ programming?
In C & C++ single quotes is known as a character ('a') whereas double quotes is know as a string ("Hello"). The difference is that a character can store anything but only one alphabet/number etc. A string can store anything.
But also remember that there is a difference between '1' and 1.
If you type
cout<<'1'< This time the first line would be 48. As when you convert a character to an int it converts to its ascii and the ascii for '1' is 48.
Same, if you do:cout<
string s="Hi";
s+=48; //This will add "1" to the string
s+="1"; This will also add "1" to the string