This topic has been archived. It cannot be replied.
-
工作学习 / IT技术讨论 / 在c语言中," 作为一个字符怎样处理? 我用单引号('"')和双引号(""")把它括起来都不行,请指点。多谢
-volunteer(angel);
2004-11-26
(#2000340@0)
-
你问的是一个double quote? try \"
-luoboyang(萝卜秧);
2004-11-26
(#2000344@0)
-
it doesn't work. the following is what i do: I get a char: " from a file, i want to tell(compare) if it is ",
-volunteer(angel);
2004-11-26
(#2000374@0)
-
is this a double quote or 2 single quotes? You can use strcmp function to compare them.
-luoboyang(萝卜秧);
2004-11-26
(#2000381@0)
-
while(strcmp( ch, ' " ') == 0 )), i want to compare ch and "(双引号)。 thks very much
-volunteer(angel);
2004-11-26
(#2000480@0)
-
try this: while(strcmp( ch, "\"") == 0 ))
-luoboyang(萝卜秧);
2004-11-26
(#2000492@0)
-
sorry, it doesn't work either.
-volunteer(angel);
2004-11-26
(#2000507@0)
-
try thischar c = '"';
if ( c == '"' )
printf("this is \" %d \n", c );
else
printf("this is %c\n", c);
result:
this is " 34
-johnnyzh(bubble);
2004-11-26
{146}
(#2000523@0)
-
it works, thks. could you help me this: if i want to compare a string(字符串) with asdf "lk, what should i use?("asdf "lk " and 'asdf "lk ' do not work).thks again
-volunteer(angel);
2004-11-26
(#2000581@0)
-
是不是正在学C呀?字符和字符串是不一样的。字符是单个的,用单引号,字符串是一串,用双引号。遇到引号在里面,需要用转义字符,一个反斜线。字符串的比较用strcmp,字符直接比较就可以了。书上都有的。
-isup(isup);
2004-11-26
(#2000596@0)
-
that is what i looking for, thks very much. i have not use c for several years. thks everybody who help me.
-volunteer(angel);
2004-11-26
(#2000617@0)
-
用google,好找的很。:))
-luoboyang(萝卜秧);
2004-11-26
(#2000655@0)