Radical Developers welcomes all the visitors to be a member of the team. Come join us. Its all about open-source concept. All Programs are written and tested in MacOS X, Unix, Linux and may not match with the outputs of Turbo C++ in Windows

Sunday, January 9, 2011

Write a program to find the length of a string using strlen().


Source Code :

#include<stdio.h>
void main()
{
      int len;
      char str[20];
      clrscr();
      printf("\nEnter a String : ");
      gets(str);
      len=strlen(str);
      printf("\nLength of the String : %d",len);
      getch();
}

Output :

Enter a String : This is a C Program

Length of the String : 19

No comments:

Post a Comment