Created
November 4, 2012 18:43
-
-
Save ernado/4012994 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <stdlib.h> | |
| using namespace std; | |
| int length(char *str) | |
| { | |
| int n = 0; | |
| while (str[n]!=0) n++; | |
| return n; | |
| } | |
| int main() | |
| { | |
| char *str = new char[80]; | |
| cout << "Enter string: "; | |
| cin >> str; | |
| cout << length(str) << endl; | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment