0
Why input values behaves different when I enclosed %d in ()
Scanf("(%d)",&x); entered value:1, output:0 Why?? https://code.sololearn.com/cO7GAAUmPQ91/?ref=app
3 Antworten
+ 1
Because that way, you are expected to also enter the value within parentheses. Try to provide (12345) as input and you'll see what I mean.
If you're not gonna use <x> in arithmetic operation in any ways, you probably wanna read a C-string instead, cause parentheses will be read without any problem for a C-string .
0
To learn how to use the functions type "man function" like in your case "man scanf" in your browser.
0
Because function scanf() dont have Format Specifier
like yours (%d) , and variable x didn't get value from input. But x have 0 value by default, and you see output from yours printf - Zero.
Some of the % specifiers that you can use , you can see here
https://www.freecodecamp.org/news/format-specifiers-in-c/