开发者

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);

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜