answersLogoWhite

0

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 the end. Be sure to free duplicated when you're done with it or you'll have a memory leak.

User Avatar

Wiki User

∙ 11y ago
User Avatar

What else can I help you with?

Related Questions

Why you use 'integer' before function in C language?

To specify the return-type of the function.


What function is used to perform exponentiation in C language?

You can use the pow() function in math.h.


How do you allocate memory dynamically for a string of unknown size in c?

With function strdup (here is an implementation, if you don't have one already)char *strdup (const char *f){size_t len;char *to;len= strlen (f);to = malloc (len+1);if (to) memcpy (to, f, len+1);return to;}


Why you use else function in c language?

You cannot have a function named else, because it is a reserved word.


How you can convert from string to int in C language?

Use the atoi() or atol() function.


What is the use of gets function in c language?

Nothing, it is a security hole. Use 'fgets' instead.


What is the differnce between ordinary function and template function of c language?

The c language does not have template functions. That is a c++ thing.


Why you are using clrscr in c language?

Function 'clrscr' is not part of the C language. Or the standard libraries. It is MS-DOS specific function, use the help for details (clrscr means clear the screen).


What is string library functions syntax?

String library function is one which is used to perform an operation in C-programming,without which library functions likestrlen(),strcp(),strcmp(),strdup(),strrev(),etc..,.can be performed


Why use setcolor function in c graphics?

C language doesn't say anything about graphics, it is platform-dependent.


How do you use cosine in c language?

Include the header file math.h and use the function acos(d)


How can you make a file in c language read only?

In UNIX: use function chmod