C++ strchr() is an inbuilt function that is used for string handling. It is defined under the string.h header file. This is used for finding the first occurrence of a character in a particular string. If the occurrence is found a pointer to the location of that particular character in the string is returned.

C++ strchr() Function

The strchr() function finds the first occurrence of a character static_cast(ch) in the byte string pointed by str. The terminating null character is considered to be the part of the string and can be found if searching for ‘\0’.

Syntax

char *strchr(const char *str_var, int oc);

#c++ #c++ strchr()

C++ strchr() Function Example | std::strchr() in C++
4.65 GEEK