Saturday, March 9, 2013

C Language Example # 34 Find length of character array using strlen function


C Language Example # 34 Find length of character array.

* Program will find length of character array using strlen function.
* Example of strlen function.
* String.h header file function strlen example.
//Written by Latest Technology Guide    
//Title : C Language Example # 
34 Find length of character array.



#include <stdio.h>
#include <conio.h>
#include <string.h>
void main()
{
clrscr();
int i;
char ch[20]={0};

printf("\n Enter Any Word : \n");
gets(ch);

i=strlen(ch);
printf("\n\n\t\aYour Word's Length is : %d",i);

getch();
}



Output:

* Program will display length of entered string.


--------------------------------------------------------------------------------
Explanation of C Programming Language Example # 34 Find length of character array.

* Program is using strlen function from string.h header files.

* Program will find lenght of string.


Note: All programs are developed and tested using Turbo C++ 3.0 under Windows XP. We just want to provide guidelines to the users. If you are using any other Compiler or other operating system they you need to modify this program as per your requirements. 

1 comment: