Convert a Number to a String in C

Last Updated : 30 Sep, 2026

Converting a number to a string in C means changing a numeric value such as 123 into a sequence of characters such as "123". This can be done using functions such as sprintf() or snprintf(), which format the number and store its character representation in a string.

Example: Use sprintf() function.

c
#include
int main()
{
    char result[50];
    float num = 23.34;
    sprintf(result, "%f", num);
    printf("\n The string for the num is %s", result);
    getchar();
}

You can also write your own function using ASCII values of numbers.

Comment