ポインタ2

#include 
#include 
#include 

int main() {
    char buffer[1000] = "";
    int length;
    char *line = NULL;
    
    printf("type character and enter key");
    gets(buffer);
    length = strlen(buffer);
    if (length > 0) {
        line = (char *)malloc(length + 1);
        strcpy(line, buffer);
        printf("line = %s\n", line);
        free(line);
    }
    return 0;
}