answersLogoWhite

0

They do different things, so they are uncomparable.

PS: strcpy can be implemented with strlen+memcpy:

char *strcpy (char *dest, const char *src)

{

size_t len;

len= strlen (src);

memcpy (dest, src, len);

return dest;

}

User Avatar

Wiki User

17y ago

What else can I help you with?

Related Questions

What are the differences between memcpy vs strcpy?

memcpy is general purpose copy. and strcpy is specific for string copying. strcpy will copy the source string to destination string and terminate it with '\0' character but memcpy takes extra argument which specifies the number of bytes to copy.memcpy will not handle copying of overlapping memory. use memove instead.


To copy two strings using strcpy?

Using strcpy and strcat. Or sprintf. Or strlen+memcpy. There are more than solutions.


Write a c program to copy the string without using strcpy?

use strcat, strncpy, stpcpy, sprintf, strlen+memcpy, etc


How do you concatenate two strings without using strcat?

Example1:sprintf (to, "%s%", from1, from2);Example2:size_t len1= strlen (from1);memcpy (to, from1, len1);strcpy (to+len1, from2);


What is the memcpy library used for in computer programming?

The memcpy library is used in computer programming to copy the value of numbers from a source to the memory block destination. Memcpy is frequently used in the C++ programming language.


Why you are using strcpy in c plus plus?

In short, you don't. strncpy is deemed unsafe as it has potential to cause buffer overruns. To copy strings safely in C++, use std::string instead. For examples and syntax, see related links, below.


What is syntax of memcpy?

memcpy function is used to copy memory area. Syntax ------ void *memcpy(void *dest, const void *src, size_t n); *dest is a destination string. *src is a source string. n is a number of characters to be copied from source string. Example: #include #include main() { char src[]="Hello World"; char des[10]; memcpy(des,src,5); printf("des:%s\n",des); //It will contain the string "Hello". }


Pointer version of string function strcpy?

char* strcpy(const char* src, char* dst) { char* tmp = dst; while ((*dst++ = *src++) != '\0'); return tmp; }


C program plus copy of string to another?

strcpy


Which function is the correct choice for moving blocks of binary data that are of arbitrary size and position in memory?

memcpy()


What is the difference between the functions memmove and memcpy?

memmove handles the case where the source memory and destination memory overlap.


Code to implement memcpy in c?

unsigned char * memcpy(unsigned char * s1, unsigned char * s2, long size) { long ix; s1= (char *)malloc(sizeof(strlen(s2))); for(ix=0; ix < size; ix++) s1[ix] = s2[ix]; return s1; }

Trending Questions
Did Samuel Slater memorized the plans for cloth-making machines and built the first textile machines in America? What is the theoretical max speed of a helicopter? 5 Why is it important to wear appropriate protective clothing and equipment? How do you waterproof drywall? How much cement required in 1 Quebec meter concrete? Creating new things to solve problems and improve life depends on the close interaction of which two fields? Which type of data structure is used in ATM to take the printout of last 5 transactions? What is the purpose of suction? Write a java program that reads a file name from the user then displays information about whether the file exists whether it is readable writable type of file and the length of the file in bytes? What is a recursive function? Is there any reason for a new radiator to leak other than faulty build? How do you declare an array of buttons in Java? When you need to satisfy two or more criteria to initiate an event in a program you must make sure that the second decision is made entirely independently of the first decision? Is it possible to extend a load capacity by using metal plates or platforms? What is cement setting? Define lists in HTML? What technology uses battery power to retain information even when the power to the computer is off? Why is tensile strength required for wires? When does a Borland c compiler throw an error as could not execute 16-bit process error code 32 when a program is executed after successful compilation? Does commencement of construction include engineering design?