Multiple choice

Which of the following functions returns the string representation from a pointer to a time t value?

  1. Localtime

  2. Gmtime

  3. Strtime

  4. Asctime

  5. Ctime

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

asctime() converts a struct tm pointer (broken-down time) to a 26-character string like 'Wed Jun 30 21:49:08 1993\n'. ctime() converts time_t directly to string. localtime() and gmtime() convert time_t to struct tm, not string. Option D is correct.