#include <string.h>
char *strdup(const char *s);
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void)
{
const char *p = "hello world";
char *sp;
sp = strdup(p);
printf ("%s\n", sp);
free(sp);
return 0;
}
$ ./strdup
hello world
欢迎光临 曲径通幽论坛 (http://www.groad.net/bbs/) | Powered by Discuz! X3.2 |