C Program For Double to String Conversion Last Updated : 01 Aug, 2022 Summarize Comments Improve Suggest changes Share Like Article Like Report To convert double to string in C language, we will use the sprintf function as follows: Input: n = 456321.7651234 Output: string: 456321.7651234 Method: Using sprintf By specifying the precision in sprintf, we can convert double to string or character array with custom precision. We can use sprintf to add extra text (as required) to the string at the same time. C // C Program to demonstrate // Double to String Conversion #include <stdio.h> int main() { double n = 456321.7651234; char str[100]; sprintf(str, "%f", n); printf("the string is: %s\n", str); return 0; } Outputthe string is: 456321.765123 Comment More infoAdvertise with us Next Article Convert String to int in C K ksrikanth0498 Follow Improve Article Tags : C Programs C Language C Conversion Programs Similar Reads C Program For Octal to Decimal Conversion The number system is one of the ways to represent numbers. Every number system has its own base or radix. For example, Binary, Octal, Decimal, and Hexadecimal Number systems are some of the number systems and are also used in microprocessor programming. These numbers are easy to convert from one sys 3 min read C Program For Char to Int Conversion Write a C program to convert the given numeric character to integer.Example:Input: '3'Output: 3Explanation: The character '3' is converted to the integer 3.Input: '9'Output: 9Explanation: The character '9' is converted to the integer 9.Different Methods to Convert the char to int in CThere are 3 mai 3 min read C Program For Int to Char Conversion To convert the int to char in C language, we will use the following 2 approaches: Using typecastingUsing sprintf() Example: Input: N = 65 Output: A1. Using TypecastingMethod 1:Declaration and initialization: To begin, we will declare and initialize our integer with the value to be converted.Typecast 2 min read Converting String to Long in C Here, we will see how to build a C Program For String to Long Conversion using strtol() function. Syntax: long int strtol(char *string, char **ptr, int base)The first argument is given as a stringThe second argument is a reference to an object of type char*The third argument denotes the base in whic 4 min read Convert String to int in C In C, we cannot directly perform numeric operations on a string representing a numeric value. We first need to convert the string to the integer type. In this article, we will discuss different ways to convert the numeric string to integer in C language.Example:Input: "1234"Output: 1234Explanation: 6 min read C Program to Swap Two Numbers Swapping two numbers means exchanging their values. In this article, we will learn how to swap values of two numbers in a C program.The easiest method to swap two numbers is to use a temporary variable. First, we assign the value of first variable to temporary variable, then assign the value of seco 2 min read Like