#include <stdio.h>
#include <string.h>
#include <stdlib.h>
char *ft_strdup(char *src)
{
    char *str;
    str = malloc(1);
    str = src;
    return str;
}
int main(void)
{
   char *string = "this is a copy";
   char *newstr;
   char *str;
   /* Make newstr point to a duplicate of string                              */
   if ((newstr = strdup(string)) != NULL)
      printf("The new string is: %s\n", newstr);
    if ((str = ft_strdup(string)) != NULL)
        printf("The new string is: %s\n", str);
   return 0;
}

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: