How to convert an int to a string in the C language?
In C language, the standard library function sprintf() can be used to convert an integer to a string. For example:
#include <stdio.h>
int main() {
int num = 123;
char str[10];
sprintf(str, "%d", num);
printf("Converted string: %s\n", str);
return 0;
}
In this example, the sprintf() function converts the integer num into a string and stores it in the str array. The converted string is then printed out using the printf() function.