LearnFrenzy
Sign in Take a free test

Input/Output with cin and cout · Input/Output MCQ · Question 15

cerr vs clog in C++ Answer, explanation & discussion

  • MCQ
  • Easy
  • 0 comments
  • Answer explained
  • Moderated community
Question 15 Back to Exercise

How do std::cerr and std::clog differ?

  • A cerr writes to a file
  • B Both write to standard error; cerr is unbuffered, clog is buffered Correct
  • C clog is for input
  • D They are identical
Correct Answer: Option B

Unbuffered cerr guarantees error messages appear even if the program crashes right after; clog is more efficient for large amounts of log output.

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!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links