Computer Science, asked by vinubindu147, 8 months ago

program to find the length of a string without using strlen() function in c++​

Answers

Answered by Anonymous
0

Answer:

void charcount( char *str)

{

int n=0;

for(int i=0; str[i]!='\n'; i++)

n++;

cout<<n;

}

IF ANY DOUBT THEN RUN IT

Answered by Berseria
11

Answer:

Required Program :

To calculate length of a string without using strlen().

# include <iostream>

#include <cstudio>

using namespace std;

int main ( )

{

char s[100], i ;

cout <<"Enter a string : " ;

gets (s) ;

for ( i = 10 ; s[i]! = '\0';++i ) ;

cout << "Length of String : " <<i ;

return 0;;

}

Input :

Enter a string : Programming

Output :

Length of String : 11

Similar questions