Use snprintf()
from stdlib.h
. Worked for me.
double num = 123412341234.123456789;
char output[50];
snprintf(output, 50, "%f", num);
printf("%s", output);
More Related Contents:
- String termination C/C++ char = 0
- ‘ ‘, ‘\n’ , scanf() and output screen
- Why does >= operator work as > operator in C when compared with 0.9 [duplicate]
- How do I concatenate const/literal strings in C?
- How to convert a string to integer in C?
- How should character arrays be used as strings?
- How do I trim leading/trailing whitespace in a standard way?
- Correct format specifier for double in printf
- Using the equality operator == to compare two strings for equality in C [duplicate]
- strcmp on a line read with fgets
- Case Insensitive String Comparison in C
- Simd matmul program gives different numerical results
- Floating point comparison `a != 0.7` [duplicate]
- Reading a string with spaces with sscanf
- How to check if a string is a number?
- Correct format specifier for return value of sizeof() in C
- C: Casting minimum 32-bit integer (-2147483648) to float gives positive number (2147483648.0)
- Comparing float and double in C
- Literal string initializer for a character array
- Is my fma() broken?
- How does strcmp() work?
- C – Serialization of the floating point numbers (floats, doubles)
- Why do strings in C need to be null terminated?
- Variadic function (va_arg) doesn’t work with float?
- Why does printf print random value with float and integer format specifier
- C -> sizeof string is always 8
- Why do you need an explicit `-lm` compiler option? [duplicate]
- Reading newline from previous input when reading from keyboard with scanf()
- C fundamentals: double variable not equal to double expression?
- How can floating point calculations be made deterministic?