Write a program to string length( ) function


 

/* Write a program to string length( ) function*/

#include<iostream.h>

#include<conio.h>

#include<string.h>

void main()

{

char a[10];

clrscr();

cout<<“enter name=”;

cin.get(a,10);

int length=strlen(a);

cout<<“length of string=”<<length;

getch();

}

/* output:

enter name=harjeet

length of string=7*/

Related Posts

Comments are closed.