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.
Loading...
Related Quiz
- Double pointers are often used in C to create a(n) ________ of pointers.
- When opening a file with fopen, what happens if the file does not exist and the mode is set to 'r'?
- How does the 'ternary' operator (?:) work in C?
- What is the behavior of malloc when the size requested is zero?
- In C++, if two overloaded functions have the same signature but differ in const qualification, it leads to ________.