Wat is de beste manier in C om een getal naar een string te converteren?
Oplossing: Gebruik de sprintf()-functie.
#include> int> main()> {> > char> result[50];> > float> num = 23.34;> > sprintf> (result,> '%f'> , num);> > printf> (> '
The string for the num is %s'> , result);> > getchar> ();> }> |
U kunt ook uw eigen functie schrijven met behulp van ASCII-waarden van getallen.