LearnFrenzy
Sign in Take a free test

C Library Functions · Library Functions MCQ · Question 11

What does time(NULL) return? Answer, explanation & discussion

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

What does time(NULL) return on most systems?

  • A The time of day as a string
  • B The current calendar time as time_t – the seconds since 1 January 1970 UTC Correct
  • C Milliseconds since the program started
  • D A struct tm
Correct Answer: Option B

Convert with localtime/gmtime to a struct tm and format with strftime. For elapsed CPU time use clock().

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