Question 2
Back to Exercise
Which conversion reads a value into a double variable with scanf()?
- A %f
- B %lf Correct
- C %d
- D %Lf
Correct Answer: Option B
scanf receives a pointer, so it must know the exact type: %f for float *, %lf for double *, %Lf for long double *. printf uses %f for both float and double because float arguments are promoted.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!