compute the length of a string
#include <string.h> size_t strlen( const char *s ); size_t _fstrlen( const char __far *s );
The strlen() function computes the length of the string pointed to by s.
The _fstrlen() function is a data-model-independent form of the strlen() function that accepts far pointer arguments. It's most useful in mixed memory model applications.
The number of characters that precede the terminating null character.
#include <stdio.h> #include <string.h> void main() { printf( "%d\n", strlen( "Howdy" ) ); printf( "%d\n", strlen( "Hello world\n" ) ); printf( "%d\n", strlen( "" ) ); }
produces the output:
5 12 0
Safety: | |
---|---|
Interrupt handler | Yes |
Signal handler | Yes |
Thread | Yes |