What is the best way in C to convert a number to a string?
Solution: Use sprintf() function.
num = 23.34;
"\n The string for the num is %s"
You can also write your own function using ASCII values of numbers.
Attention reader! Don’t stop learning now. Get hold of all the important C++ Foundation and STL concepts with the C++ Foundation and STL courses at a student-friendly price and become industry ready.