+ 1

Difference between scanf("%c",p); and scanf("%c",&p); in c???

16th Jul 2020, 3:08 AM
C Lover
6 Réponses
+ 3
In C scanf() requires pointers to the variable in which the value is to be stored. Therefore we pass address(&). Without that it gets error. 🙂
16th Jul 2020, 3:17 AM
v@msi😉
v@msi😉 - avatar
+ 1
Krishna vamsi but scanf("%c",p); also works without errors
16th Jul 2020, 3:18 AM
C Lover
+ 1
C Lover I think it will be better if you can save and share your full code here so the doubt can be cleared. And please remove Java from the thread's tags for context clarity improvement 👍
16th Jul 2020, 6:07 AM
Ipang
0
Yes it runs without compile time error, but you can't access it
16th Jul 2020, 3:20 AM
v@msi😉
v@msi😉 - avatar
16th Jul 2020, 3:32 AM
v@msi😉
v@msi😉 - avatar
0
I can able to access
16th Jul 2020, 3:56 AM
C Lover