xxxxxxxxxx
#include <iostream>
// User-defined function to find the length of a string
int findStringLength(const char* str) {
int length = 0;
while (str[length] != '\0') {
length++;
}
return length;
}
int main() {
// Example usage
const char* myString = "Hello, World!";
int length = findStringLength(myString);
std::cout << "Length of the string: " << length << std::endl;
return 0;
}