Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Zortech C++ 3.0r4 - <b>strdup</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
strdup

Usage

   #include <string.h>
   char *strdup(const char *string);

Description

   strdup allocates memory with a call to malloc, copies the string into it
   and returns a pointer to the malloced string.

Example 

   #include <stdio.h>
   #include <string.h>
   #include <stdlib.h>

   char string1[50] = " 1 Example string ";

   int main()
   {
       printf("\nstrdup example [%s]\n", strdup(string1));
       return EXIT_SUCCESS;
   }

Return Value

   Returns NULL if memory cannot be allocated.





Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson