0
Printf("float: %ld", sizeof(float)); in this code if I give %lf instead of %ld it shows 0.000000 why? Why it not shows 4.0?
2 ответов
+ 3
Please give an MWE
https://www.sololearn.com/post/75089/?ref=app
+ 3
`sizeof` operator returns a `size_t` type value, which is an unsigned integer value
"%lu" or "%zu" is meant for `size_t` which is an unsigned integer type.
"%lf" is meant for `double` which is a floating point type
In short, inappropriate format specifier gives us unpredictable result, so take care when choosing format specifiers, pick one that suits the data type of argument to be printed or read.