C strlen function

« Previous

Synopsis:

Example

#include <stdio.h>
int strlen(char *src );

Description:

The strlen function calculates the length, in bytes, of src. This calculation does not include the null terminating character.

Return Value

The strlen function returns the length of src.

Example

Example

#include <stdio.h>
int main() {
  char string1[20];
  char string2[20];
  strcpy(string1, "Learn");
  strcpy(string2, "NewFile.oo");
  printf("Length of string1 : %d\n", strlen( string1 ));
  printf("Length of string2 : %d\n", strlen( string2 ));
  return 0;
}

Output Will Be :

Output

Length of string1 : 5
Length of string2 : 7


« Previous
Have Any Suggestion? We Are Waiting To Hear from YOU!

Your Query was successfully sent!