char *my_strdup(const char *inS) { char *theAns = malloc(sizeof(inS)); /* ←間違い! これでは「const char *」の 占有サイズしか取れない */ if(NULL != theAns){ strcpy(theAns,inS); } return theAns; }