+ 2
Initializing Var with Scanf()
Why is this not working: long int input = scanf("%ld",&input); Is it forbidden to define a var this way?!
4 Antworten
+ 1
scanf("%ld", &input); is fine, but long int input = scanf("%ld", &input); makes you get an value you don't expect.
You can do:
long int input = 0;
scanf("ld", &input);
0
I am not sure about this, but I reckon that you can’t use the word input as a variable name. probably a reserved name.
several languages have this
0
@Brave Tea Nope - thats not the case
0
Yep, i know. The question is: why?