C Language Example # 17 String Example : Find Length of String.
* Lets now starts with String Header File concept.
* Example of C Language String : Find Length of String
//Written by Latest Technology Guide
//Title : C Language Example # 17 String Example : Find Length of String.
#include <stdio.h>
#include <conio.h>
#include <string.h>
void main()
{
clrscr();
char ch[30]={0};
printf("\n Now Enter Text : ");
gets(ch);
printf("\n\t\t *****: Detail Description :***** ");
printf("\n Length of String is = %3d",strlen(ch));
getch();
}
* You can find out Length of string
Enter String for example : Programming
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.
* Lets now starts with String Header File concept.
* Example of C Language String : Find Length of String
//Written by Latest Technology Guide
//Title : C Language Example # 17 String Example : Find Length of String.
#include <stdio.h>
#include <conio.h>
#include <string.h>
void main()
{
clrscr();
char ch[30]={0};
printf("\n Now Enter Text : ");
gets(ch);
printf("\n\t\t *****: Detail Description :***** ");
printf("\n Length of String is = %3d",strlen(ch));
getch();
}
Output:
* You can find out Length of string
Enter String for example : Programming
You will receive output : Length of string is = 12
--------------------------------------------------------------------------------
Explanation of C Programming Language Example # 17 String Example : Find Length of String.
* Enter String of your choice
--------------------------------------------------------------------------------
Explanation of C Programming Language Example # 17 String Example : Find Length of String.
* Enter String of your choice
* You will find output as length of string using strlen() function from string.h library.
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.
No comments:
Post a Comment