Question: The standard library function strlen() (found in string.h) returns the number ofcharacters in a string, not including the terminating NUL ('0') character. Write your own

The standard library function strlen() (found in string.h) returns the number ofcharacters in a string, not including the terminating NUL ('\0') character. Write your own StringLength() function that does exactly the same thing. Write a shortmain() program to declare and initialize a string. Pass the string toStringLength() to demonstrate that it can return an integer value representing the number of characters in the test string. Use a cout statement in main() to printout the length of the string.

Please note: Your function should count the characters in the string, not accesssome C++ library function or method. DO NOT #include or . There should be no console input or output in the function. All input/output should be in main().

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!