C Strlen Example
Defined in header <string.h> size_t strlen ( const char * str ) ; (1) size_t strnlen_s ( const char * str , size_t strsz ) ; (2) (since C11) 1) Returns the length of the given null-terminated byte string, that is, the number of characters in a character array whose first element is pointed to by str up to and not including the first null character. The behavior is undefined if str is not a pointer to a null-terminated byte string. 2) Same as (1) , except that the function returns zero if str is a null pointer and returns strsz if the null character was not found in the first strsz bytes of str . The behavior is undefined if both str points to a character array which lacks the null character and the size of that character array < strsz ; in other words, an erroneous value of strsz does not expose the impending buffer overflow. As with all bounds-checked functions, strnlen_s is only guaranteed to be available if __S...