[英]converting a string to a simple one character value in C language
I'm writing a compiler with Flex and Bison using C langage and need to convert a character string to a one simple character.我正在使用 C 语言编写带有 Flex 和 Bison 的编译器,并且需要将字符串转换为一个简单的字符。 which functions should i use?
我应该使用哪些功能? i can't find it.
我找不到它。 forexample:
例如:
-string to integer we use : int i = atoi(yytext);
-string to float we use : float f = atof(yytext);
If I understand your question, a character string with one value is just a character string of [0]
so why not just do something like...如果我理解您的问题,具有一个值的字符串只是
[0]
的字符串,那么为什么不做类似...
char new_char = char_string[0];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.