You are on page 1of 1

Calculate String Length

============================================
#include <iostream.h>
#include <conio.h>

void main()
{
clrscr();
char string[500];
int length=0;
cout<<"Enter a String: ";
cin>>string;
for (int i=0;i<500;i++)
{
if (string[i]=='\0')
break;
else
length++;
}
cout<<"\nString Length: "<<length;

getch();
}

http://www.ravianeducation.blogspot.com
FARHAN: 03008855006