Multiple choice

Which of the following string functions in C++ returns a pointer to the first occurrence of character in string and returns NULL, if the specified character is not found in the string?

  1. strcpy()

  2. strstr()

  3. strchr()

  4. Both (2) and (3)

  5. strcmp()

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

This function determines the first occurrence of the character in the given string and if no match is found, then a NULL pointer is returned.