C语言 在 C 中将 long long 转换为字符串?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16095248/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 06:05:18 来源:igfitidea点击:
Convert long long to string in C?
提问by Tommy
I'd like to convert a long long to a string in C.
我想在 C 中将 long long 转换为字符串。
long long x = 999;
I'd like to convert x to a string. How could I go about doing that?
我想将 x 转换为字符串。我怎么能这样做呢?
Thanks.
谢谢。
回答by Ziffusion
long long x = 999;
char str[256];
sprintf(str, "%lld", x);
printf("%s\n", str);

