Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22047

The big prefix L has no effect in %Lf, the result in printf() is same as just %f [duplicate]

$
0
0

Currently learning about C language, I repeated after guy in tutorial, he used printf("value = %Lf\n", var_some); construction to output the value of long double variable, and it worked.But when I repeated the same, it returns some unexpected very long negative number. If I run code without L, it returns exactly the same, like 'L' gives no effect.

#include <stdio.h>int main(void){       long double var_some = 123456221312.2132323213123121;    printf("value = %Lf\n", var_some);    return 0;} 

If I make this variable simple double without 'long', then it works fine , even if I add 'L'.

I am using gcc compiler.


Viewing all articles
Browse latest Browse all 22047

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>