Why does the call char scanf work?
C Interview Questions and Answers
(Continued from previous question...)
Why does the call char scanf work?
Q: Why does the call
char s[30];
scanf("%s", s);
work? I thought you always needed an & on each variable passed to scanf.
A:You always need a pointer; you don't necessarily need an explicit &. When you pass an array to scanf, you do not need the &, because arrays are always passed to functions as pointers, whether you use & or not.
(Continued on next question...)
Other Interview Questions
|