The strlen () function in C
The function size_t strlen (const char * str) calculates the length of str string (not including the ending null character).
The function size_t strlen (const char * str) calculates the length of str string (not including the ending null character).
Declare the strlen () function in C
Here is the declaration for strlen () in C:
size_t strlen ( const char * str )
Parameters
str - Is a string to find the length.
Returns the value
This function returns the length of the string.
For example
The following program C illustrates the usage of strlen () in C:
#include #include int main () { char str [ 50 ]; int len ; strcpy ( str , "Hoc C co ban va nang cao tai QTM !!!" ); len = strlen ( str ); printf ( "Do dai cua chuoi:n |%s| nla bang:n |%d|n" , str , len ); return ( 0 ); }
Compile and run the above C program to see the results:
According to Tutorialspoint
Previous article: strerror () function in C
Next lesson: strpbrk () function in C
4 ★ | 1 Vote
Read More
- DAY function in SQL Server
- MIN function in SQL Server
- MAX function in SQL Server
- SUM function in SQL Server
- The ord () function in Python
- RIGHT function in SQL Server
- Int () function in Python
- AVG function in SQL Server
- 6 Conditional Functions That Make Excel Spreadsheets Smarter
- Hex () function in Python
- ABS function in SQL Server
- SUM for Newbies Only: Excel Experts Use This Function Instead!
- The function id () in Python
- DATEPART function in SQL Server