编辑代码

#include <stdio.h>
#include <stdlib.h>

int main (int argc, char * argv[]) {
    int size;

    printf("entry an number of char number: ");
    scanf("%d", &size);

    // malloc 申请内存, 参数为字节大小, 返回相应类型的指针
    char * ptc = (char *) malloc(size * sizeof(char));
    printf("entry %d char:", size);
    scanf("%s", ptc);
    printf("your entry char is: %s\n", ptc);
	return 0;
}