Interview Questions

WWhy doesnt the call scanf work?

C Interview Questions and Answers


(Continued from previous question...)

WWhy doesnt the call scanf work?

Q: Why doesn't the call scanf("%d", i) work?

A: The arguments you pass to scanf must always be pointers: for each value converted, scanf ``returns'' it by filling in one of the locations you've passed pointers to. To fix the fragment above, change it to scanf("%d", &i) .

(Continued on next question...)

Other Interview Questions