I'm encountering an issue while using the printf()
function and I'd like to share the details. The two main sources I'm referring to, cplusplus.com and cppreference.com, indicate that I can use the %f
and %F
format specifiers.
However, when I attempt to use the %F
format specifier in Code::Blocks 20.03, I'm unable to get the desired output. While this format specifier is indicated as usable in other sources, I'm puzzled as to why it's not working in my compiler.
code input:
#include<stdio.h>
#include<float.h>
int main()
{
float decimal_floating_point = 1.234567;
float Decimal_Floating_Point = 123.4567;
printf("decimal floating point = [%f]\n",decimal_floating_point);
printf("Decimal Floating Point = [%F]\n",Decimal_Floating_Point);
}
code output:
decimal floating point = [1.234567]
Decimal Floating Point = []
Why am I getting the result Decimal Floating Point = []
instead of the expected Decimal Floating Point = [123.4567]
?