Machine-translated by Google. Questions are authored in English.
Top

Discussion

Which code from the given option return pointer to last occurrence of c in ch or NULL if not present?

  • A.char *strchr(ch, c)
  • B.char *strrchr(ch, c)
  • C.char *strncat(ch, c)
  • D.char *strcat(ch, c)

Answer: B

Correct answer: char *strrchr(ch, c)

The extra r stands for reverse: strrchr returns a pointer to the last occurrence of the character, or NULL if it is absent. It is the usual way of finding a file extension, by searching for the last dot.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.