Cannot get strlen w/ pointers to work

I cannot get the strlen function to work properly. Any ideas?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include <iostream>
#include <cstring>

using namespace std;

char again;

void length(char *);

int main()
{
	do
	{
		const int SIZE = 1000;
		char input[SIZE];

		cout << "---String Length---" << endl;
		cout << "Enter a string: " << endl << endl;
		cin.getline(input, SIZE);

		cout << endl;
		cout << "The number of characters within that string is: ";
		length(input);
		cout << endl;
		

		cout << "Do you want to run this program again? Y/N: ";
		cin >> again;

	} while (again == 'y' || again == 'Y');

	return 0;
}

void length(char *str)
{
	int l;
	l = strlen(str);
	cout << endl << endl;
}
You don't do anything with l in length.
How would I go about doing it with "length"?
It looks like you want to print the value of l.
cout << l << endl;
It works now. Thanks for the help!
Topic archived. No new replies allowed.