noob string question
Posted: Sun Aug 10, 2014 1:40 am
Learning c++ using Codelite.
This works:
string z
z="";
z=z+"123"+"4";
but this will not compile: (invalid operands...binary operator)
z= "123" + "4" ;
I found from trial and error I had to start any concatenation assignment with a string variable, otherwise it won't compile.
Can someone help me understand why?
This works:
string z
z="";
z=z+"123"+"4";
but this will not compile: (invalid operands...binary operator)
z= "123" + "4" ;
I found from trial and error I had to start any concatenation assignment with a string variable, otherwise it won't compile.
Can someone help me understand why?