Convert long long to string in C?

2019-04-08 18:12发布

问题:

I'd like to convert a long long to a string in C.

long long x = 999;

I'd like to convert x to a string. How could I go about doing that?

Thanks.

回答1:

long long x = 999;
char str[256];
sprintf(str, "%lld", x);
printf("%s\n", str);