Created
April 23, 2013 16:22
-
-
Save hrshadhin/5445064 to your computer and use it in GitHub Desktop.
calculate String length
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<stdio.h> | |
| #include<string.h> | |
| int main() | |
| { | |
| char string[100]; | |
| printf("Enetr your string that you want to caculate its length:\n"); | |
| gets(string); | |
| int len=0,n=0; | |
| while(string[n] != '\0')//length calculate | |
| { | |
| n++; | |
| len++; | |
| } | |
| printf("the string length is %d",len); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment