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.
The Long. toString() method converts long to String. The toString() is the static method of Long class.
The itoa (integer to ASCII) function is a widespread non-standard extension to the standard C programming language. It cannot be portably used, as it is not defined in any of the C language standards; however, compilers often provide it through the header <stdlib.
The itoa() function coverts the integer n into a character string. The string is placed in the buffer passed, which must be large enough to hold the output. The radix values can be OCTAL, DECIMAL, or HEX.
long long x = 999;
char str[256];
sprintf(str, "%lld", x);
printf("%s\n", str);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With