Solution: Use sprintf() function.
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 DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Convert a floating point number to string in C
- How to convert C style strings to std::string and vice versa?
- gcvt() | Convert float value to string in C
- Convert C/C++ code to assembly language
- Convert C/C++ program to Preprocessor code
- Program to Convert Hexadecimal to Octal
- How to find length of a string without string.h and loop in C?
- Print substring of a given string without using any string function and loop in C
- Print all possible combinations of the string by replacing '$' with any other digit from the string
- std::string::crbegin() and std::string::crend() in C++ with Examples
- Converting string to number and vice-versa in C++
- C program to count number of vowels and consonants in a String
- How to split a string in C/C++, Python and Java?
- C++ string class and its applications
- Different methods to reverse a string in C/C++
- C++ String Class and its Applications | Set 2
- Removing spaces from a string using Stringstream
- std::string class in C++
- Conversion of Struct data type to Hex String and vice versa
- Counts of distinct consecutive sub-string of length two using C++ STL