logo

Jaký je nejlepší způsob v C převést číslo na řetězec?

Řešení: Použijte funkci sprintf().








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



>

>

Můžete také napsat svou vlastní funkci pomocí ASCII hodnot čísel.