what is difference between a)strcpy and memcpy b) memcpy and memmov?
shanki himanshu 27 Light Poster
Recommended Answers
Jump to Post— deceptikon 1,790strcpy() uses '\0' as the stopping character while memcpy() requires you to specify how many bytes are being copied. memcpy() isn't guaranteed to be safe if the source and destination blocks overlap while memmove() does have that guarantee at the cost of performance.
Due to the types involved, the mem* …
Jump to Post— deceptikon 1,790strcpy() and memcpy() aren't the ones doing the outputing. Obviously if there's a null character in the middle of the string, puts() will stop on it.
Jump to Post— deceptikon 1,790this means when i used memcpy the whole string is copied in str1 while using strcpy str1 contains only "mem"??
Yes, though since you told memcpy() to copy 10 bytes, you wrote too many characters and invoked undefined behavior.
stronly contains 8 characters, after all (including null …
All 10 Replies
deceptikon 1,790 Code Sniper Team Colleague Featured Poster
shanki himanshu 27 Light Poster
deceptikon 1,790 Code Sniper Team Colleague Featured Poster
shanki himanshu 27 Light Poster
deceptikon 1,790 Code Sniper Team Colleague Featured Poster
shanki himanshu 27 Light Poster
rithish 13 Junior Poster in Training
rithish 13 Junior Poster in Training
shanki himanshu 27 Light Poster
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.