What is the method for converting an integer in C language to a string?
In C language, you can use the sprintf function to convert an int type to a string type by formatting the int value as a string. Here is a simple example:
#include <stdio.h>
int main() {
int num = 123;
char str[10];
sprintf(str, "%d", num);
printf("The integer as a string is: %s\n", str);
return 0;
}
In this example, the sprintf function formats the integer num into a string and stores it in the str array. Finally, the printf function prints the string.