4 ms·
char *name = (char *) malloc(11); // Assign some value to name memcpy ( p,name,11); // Problem begins here "In this example, the memcpy operation is t
by larssorenson 12y ago
char *name = (char *) malloc(11);
// Assign some value to name
memcpy ( p,name,11); // Problem begins here
"In this example, the memcpy operation is trying to write 11 bytes to p, whereas it has been allocated only 10 bytes."
I'm sorry, but I see it as having malloc'd 11 bytes...
- jibsen 12y agoThe first parameter to memcpy is the destination.