开发者

How to make a parameter to char C++

开发者 https://www.devze.com 2023-02-26 22:51 出处:网络
I have a split-method which takes 2 开发者_开发技巧parameters in, a char and a string: split(char sk, string st)

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

精彩评论

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