What is strnlen( ) function in C ?

strnlen( ) function in C is basically used to determine the length of the given string on the basis of 'n' parameters.

what is strlen() function in c
strnlen( ) in C

Through this article we are going to discuss about strnlen( ) function in detail in which following topic are included

  1. strnlen( ) function in C
  2. strnlen( ) function header file
  3. strnlen( ) function in C syntax
  4. strnlen( ) function in C example
  5. strnlen( ) function return value in C

strnlen() function in C

strnlen( ) function is also know as built in function or standard library function of C but it is widely know as string function in C language it works as similar to strlen( ) function that means it also used in C language to determine the length of given string in program by using 'n' parameters.
Where 'n' is number at which we want to determine the length of the string and one more thing strnlen( ) is also does not consider null value in length of the string.

strnlen() header file in C

strnlen( ) function is a built function in C language which are define in <string.h> header file without this header file we can't be access this function in our C program.

strnlen() return value in C

On success this function return an integers value, otherwise it return NULL value.

strnlen() syntax in C

strnlen(str,str1,n);

strnlen() example in C

#include<stdio.h>
#include<string.h>
int main()
{

  int n;
  char str[15]="Akash";
  n=strnlen(str,4);
  printf("%d",n);
  return 0;
}

___________________________________

Example of strnlen() function in c

____________________________________________________

Conclusion

This function is basically helps to determine the length of the given string by using 'n' parameters.
Post a Comment (0)
Previous Post Next Post