what would be happen if we copy the size of source more than the size of the destination using memcpy function
unsigned short dst[128];
unsigned short source[256];
memcpy(dst, source, 1000);
This is a discussion on Memcopy within the C++ Programming forums, part of the General Programming Boards category; what would be happen if we copy the size of source more than the size of the destination using memcpy ...
what would be happen if we copy the size of source more than the size of the destination using memcpy function
unsigned short dst[128];
unsigned short source[256];
memcpy(dst, source, 1000);
memcpy starts writing to memory beyond the bounds of dest like nothing is wrong, which may or may not trigger a segmentation fault in response to the undefined behavior.
Originally Posted by phantomotap
Buffer overrun.
Why would you use memcpy in C++ anyway?
For information on how to enable C++11 on your compiler, look here.
よく聞くがいい!私は天才だからね! ^_^