What would you like to do?

What are the differences between strdup and strcpy functions used in C?

already exists.

Would you like to merge this question into it?

already exists as an alternate of this question.

Would you like to make it the primary and merge this question into it?

exists and is an alternate of .

strcpy - copy a string to a location YOU created (you create the location, make sure that the source string will have enough room there and afterwards use strcpy to copy) strdup - copy a string to a location that will be created by the function. The function will allocate space, make sure that your string will fit there and copy the string. Will return a pointer to the created area.
+ 9 others found this useful
Thanks for the feedback!

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 m

What is the difference between functions and variables?

Variables define a certain value, such as an integer, string,  boolean value, etc. Functions are defined to run a certain task,  and may or may not return a value. You can h

Write a function in 2 lines to copy one string to another without using strcpy?

There is almost nothing to explain if you know C Language. Here is the program:   #include void copyString(const char *src, char *dest); int main() { char str1[100

Difference Between strcpy and memcpy?

memcpy will copy NULL bytes also, but strcpy will stop copying if it encounters NULL Byte, since it consider NULL as a terminating character. cheers, som shekhar And anoth

What are the differences between Macros and Functions in C Language?

Macros are essentially shorthand representations of arbitrary sections of the source code, which makes the source code succinct, while its (the macro template's) expansion rep

What exactly is the difference in function between the US Army and US Marine Corps?

There is a world of difference as far as training and how things are run. The Marines are more specialized for combat. All Marines regardless of occupation receive infantry tr

What is the difference between function and recursive function?

I will explain in the easiest way the difference between the  function and recursive function in C language.    Simple Answer is argument of the function is differ but

What is the difference between a function and an equation?

A function describes a relation between several variables. For example the function f(x)=x2 describes a mapping from the variable x to a value that is the square of x. That is
In Science

What is the difference between a process and a function?

A program under execution is called a process. Hence a process will be loaded and run from the computer memory. A function is a small module within a program which gets some k

What is the difference between main function in C java?

// C   int main(int argc, char** argv) {   return 0;   } // Java class MainClass {   public static void main(String[] args) { }   } Differenc