0
Explain the output please.
#include <stdio.h> int main() { float a =0.7; if(0.7>a) { printf("hi"); } else { printf("hello"); } return 0; }
5 Respuestas
0
But if you compile this code the output is hi.... Seb TheS
+ 3
Because the expression 0.7>a is false,
if statements were ignored,
else statements were executed instead,
printed "hello"
+ 2
Well I have a hypothesis that decimal numbers are set to double floating point numbers as default.
Because different datatypes are compared, C may compare them by their memory instead.
Doubles require 2*more memory that floats.
+ 2
The hypothesis worked only, when the values in the example were equal.
0
Yes, Now I understand 😊😊
Thank you Seb TheS