| How can I display a number variable on the screen (like an int)?

| Graphics and Display | Next

Q: | How can I convert an integer or a float to a string?

A:

It's easy. Use sprintf. For example:

    char string1[50];
    char string2[50];
    short int var1;
    float var2;
    ...
    sprintf (string1, "%d", var1);
    sprintf (string2, "%f", var2);

That's why there is no need for functions like itoa and ftoa in opposite to atoi and atof.