How to make a parameter to char C++
I have a split-method which takes 2 开发者_开发技巧parameters in, a char and a string:
split(char sk, string st)
But when I'm calling the method like below, I get this error-message:
expected primary-expression before ':' token
g.split(:, string);
Is it any way I can make call to understand that : is a char?
Use single quotes
g.split(':', string);
Use g.split(':', string);
.
Single quotes do the trick.
Use single quotes:
g.split(':', string);
Call like below in a valid way:
g.split(':', "string"); // can not pass string also simply (type is not expected)
Use single quotes, g.split(':', string);
精彩评论