Store string into array in c

后端 未结 6 1344
孤城傲影
孤城傲影 2021-02-14 21:28

As i know, i can create an array with item inside such as:

char *test1[3]= {\"arrtest\",\"ao\", \"123\"};

but how can i store my input into arr

6条回答
  •  太阳男子
    2021-02-14 22:06

    try below code:

    char *input[10];
    input[0]=(char*)malloc(25);//mention  the size you need..
    scanf("%s",input[0]);
    printf("%s",input[0]);
    

提交回复
热议问题