logo

Aký je najlepší spôsob v C previesť číslo na reťazec?

Riešenie: Použite funkciu 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 tiež napísať svoju vlastnú funkciu pomocou ASCII hodnôt čísel.