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.
29 people found this useful
Thanks for the feedback!

What is the difference between actual and formal arguments used in functions in C language?

The arguments passed to the functions while the function is called is known as the actual arguments, whereas the arguments declared in the function header is called as formal

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

How can use Strdup function in c language?

char* duplicated strdup("Hello World"); duplicated will now contain the address to dynamically allocated memory of a C-style string that contains "Hello World" and a null at

What is the difference between an abstract class and virtual function in C?

  Take a look around you, find me an object which you couldn't classify. In reality, the whole world around you is classified in some way. Life and genes, elements a

What is the difference between simple program and function in C?

  A function is a piece of code that has no or more arguments, that returns no or one value.   A program is code that implements the function int main(int argc, char**

What is the difference between member functions and friend functions in c plus plus?

A friend function is declared outside of the class in which it is declared a friend but has the same privileges as any other member of the class. Moreover, a friend function c

What is the difference between function overloading and function overriding in c plus plus?

Function overloading applies only to functions within the same namespace, where all the overloads share the same function name, but differ in the number and/or type of argumen

What is the difference between a member function and a virtual member function in c plus plus?

Member functions are not expected to be overridden by derived classes whereas virtual member functions are expected to be overridden by derived classes. By contrast, pure-virt