#include <string.h>
|
char *
strdup (const char *str); |
If insufficient memory is available, NULL is returned and errno is set to ENOMEM.
#include <string.h> #include <stdio.h> int main() { char* ptr; ptr = (char *)strdup("abcde"); printf("Duplicated string %s\n",ptr); ptr = (char *)strdup("Hello Hi"); printf("Duplicated string %s\n",ptr); return 0; }
Output
Duplicated string abcde Duplicated string Hello Hi
© 2008 Nokia Corporation. All rights reserved. This documentation can be used in the connection with this Product to help and support the user. |