Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- char[] str = "foo-bar";
- memcpy(&str[3],&str[4],4); //might blow up
- memmove(&str[3],&str[4],4); //fine
- int SIZE = 100;
- Item *ptr_item = (Item *) malloc(size_of(Item) * SIZE);
- Item *ptr_src_item = ptr_item + 1;
- Item *ptr_dst_item = ptr_item;
- memmove(ptr_dst_item, ptr_src_item, SIZE - 1);
- int SIZE = 100;
- Item *ptr_src_item = (Item *) malloc(size_of(Item) * SIZE);
- Item *ptr_dst_item = (Item *) malloc(size_of(Item) * (SIZE - 1));
- memcpy(ptr_dst_item, ptr_src_item, SIZE - 1);
Add Comment
Please, Sign In to add comment