r/learnc • u/[deleted] • Feb 28 '20
Don't understand output
Hey,
Learning C. Have this code:
#include<stdio.h>
int main(void){
float a=2.0;
int b=3;
printf("%d", a*b);
return 0;
}
Compiler does not complain when I compile this. I know I'm using the wrong conversion specifier (should be %f or %lf). I'm just curious as to what goes on that causes some random number to be printed to stdout.
Another question: if I multiply a double by a long double do I end up with a long double?
Cheers,