Answered step by step
Verified Expert Solution
Question
1 Approved Answer
write a c++ code strlen: Accepts a C-string or a pointer to a string as an argument. Returns the length of the string (not including
write a c++ code
strlen: Accepts a C-string or a pointer to a string as an argument. Returns the length of the string (not including the null terminator. Example Usage: len = strlen(name); strcat: Accepts two C-strings or pointers to two strings as arguments. The function appends the contents of the second string to the first string. (The first string is altered, the second string is left unchanged.) Example Usage: strcat(string1, string2); strcpy: Accepts two C-strings or pointers to two strings as arguments. The function copies the second string to the first string The second string is left unchanged. Example Usage: strcpy(string1, string2)) strncpy: Accepts two C-strings or pointers to two strings and an integer argument. The third argument, an integer, indicates how many characters to copy from the second string to the first string. If the string2 has fewer than n characters, string1 is padded with 1O' characters. Example Usage: strncpy(string1, string2, n) strcmp: Accepts two C-strings or pointers to two string arguments. If string1 and string2are the same, this function returns 0. If string2 is alphabetically greater than string1, it returns a negative number. If string2 is alphabetically less than string1, it returns a positive number. Example Usage: if (strcmp(string1, string2)) strstr: Accepts two C-strings or pointers to two C-strings as arguments, searches for the first occurrence of string2 in string1. If an occurrence of string2 is found, the function returns a pointer to it. Otherwise, it returns a NULL pointer (address 0). Example Usage: coutStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started