+ 3

We declared the variable as float and then gave integer value to it so why didn't that show any error..

Quetion: #include <iostream> Using namespace std; int main() { float a=10; if(a == 10) cout<<"YES"; return 0; } Output :- YES If any one have the link of the theory or concept of above question...then please send me..

23rd Jan 2021, 5:27 AM
Janvi Desai
3 Answers
+ 3
While assigning value to "a", 10 is internally converted to 10.0 ( which is a floating point number ). This process is known as implicit type conversion.
23rd Jan 2021, 5:41 AM
Arsenic
Arsenic - avatar
+ 3
Can you explain me in deeply ? Please what is about implicit type conversion .. for other data types
23rd Jan 2021, 5:43 AM
Janvi Desai
23rd Jan 2021, 5:45 AM
Arsenic
Arsenic - avatar