Parameters of strchr() in C
- str: It is the string in which we have to search the character. This string is a constant character pointer, meaning that the function will not modify the string.
- ch: It is a character to be searched in the string. Though passed as an int, it represents a character and is cast internally. This allows strchr() to be used with character values, including special characters and ASCII values.
strchr in C
The strchr() function in C is a predefined function in the <string.h> library. It is used to find the first occurrence of a character in a string. It checks whether the given character is present in the given string or not, if the character is found it returns the pointer to it otherwise it returns a null pointer indicating the character is not found in the string.
Contact Us