|
|
strlen() - String Manipulation Function
|
Tutorials

Cpp

|
Topic |
How to find length of the string used in C++?
|
|
Explanation |
|
strlen() manipulation function is used to find the length of a string between starting character
and the terminating NULL character.
Syntax:
size_t strlen ( const char * str );
Example:
#include <stdio.h>
#include <cstring.h>
int main ()
{
char str1[50];
strcpy(str1,"My name is alex");
printf ("The length of str1 is:: %u\n",strlen(str1));
return 0;
}
|
Result:
The length of str1 is:: 15
In the above example, "strlen()" manipulation function is used to find the length of "str1".
|
| Note |
C++ is one of the most used programming languages in the world. Also known as "C with Classes".
Hope you enjoy this tutorial. Do send your feedback or suggestions on this C++ tutorial. This is a copyright content.
|
|
|
|