/* pointer-string-function.c */ #include #include #include int main(void) { char *str; str = malloc(100 * sizeof(char)); /* strの指す文字列の領域を確保*/ strcpy(str, "abc"); printf("文字列%sの長さは%zuです。\n", str, strlen(str)); free(str); /* 使い終わった領域を解放 */ return 0; }