In C++
Define a function
int length(char s[])
that returns the length of C-String s (not including theterminating null character).
For example
length(“abc”) will return 3
and length(“”) will return 0.
Driver code below.
#include <iostream>
using namespace std;
int length (char s[]) ;
int main() {
char s[80];
cin.getline(s,80);
cout << “s = “” << s <<“”” << endl;
cout << “length = ” << length(s)<< endl;
return 0;
}
Expert Answer
An answer will be send to you shortly. . . . .