A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
Is it explicit or implicit type conversion?
Debojit Acharjee
455
Reputation points
When a format specifier of a type that is different from the variable is used with printf to show a value of another data type then it's implicit type conversion or explicit one?
#include <stdio.h>
int main()
{
double a = 3.5;
int b = 6;
printf("Value of a as int: %d\n", a);
printf("Value of b as double: %lf", b);
return 0;
}
Output:
Value of a as int: 0
Value of b as double: 3.500000
I also want to know why the value of a is printed instead of b?
Developer technologies | C++
Developer technologies | C++
Developer technologies | Visual Studio | Other
Developer technologies | Visual Studio | Other
A family of Microsoft suites of integrated development tools for building applications for Windows, the web, mobile devices and many other platforms. Miscellaneous topics that do not fit into specific categories.
Sign in to answer