0
Why is the output of int and float always 2358860 and 0.0000000?
#include <stdio.h> int main() { int x; float num; char text[20]; scanf("%d %f %s", &x, &num, text); printf("%d %f %s", &x, &num, text); /*Why does the output of any input always equal 2358860, 0.000000, but the text is accurate. */ }
4 Answers
+ 7
you're printing the address where the value is been stored
+ 2
Because & operator is used to print the address .
+ 2
Thanks everyone, didn't realize the purpose of the address specifier this early on
+ 1
Because you shouldn't use the & operator within the printf.