What is a potential risk when using the strcpy function in C?
- Buffer overflow
- Compilation error
- Memory leak
- Segmentation fault
The strcpy function in C copies a string to a destination buffer without checking the length, which can lead to buffer overflow if the source string is longer than the destination buffer. This can result in overwriting adjacent memory, causing potential security vulnerabilities or program crashes.
Loading...
Related Quiz
- Why is it recommended to use pointer arithmetic instead of array indexing for traversal in some cases?
- What potential issue should be considered when using recursion in C programs?
- A ________ allows multiple variables to share the same memory location.
- In C, to close a file opened by fopen, the function ________ is used.
- What is the difference between an array and a pointer in the context of C programming?