In C, the ________ function is used to copy a specified number of characters from one string to another.

  • memcpy()
  • strcpy()
  • strncat()
  • strncpy()
In C, the strncpy() function is used to copy a specified number of characters from one string to another. Unlike strcpy(), it allows you to specify the maximum number of characters to copy, which helps prevent buffer overflows and enhances program security.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *