据我所知,我可以创建一个带有项目的数组,例如:
但是我应该如何将我的输入存储为类似上面代码的数组,因为我只能将其编写为
char *test1[3]= {"arrtest","ao", "123"};
但是我应该如何将我的输入存储为类似上面代码的数组,因为我只能将其编写为
input[10];
scanf("%s",&input) or gets(input);
它会将每个字符存储到各自的空间中。
如何将输入"HELLO"存储到input[0]中,而不是像现在这样
H 存储到 input[0],E 存储到 input[1],以此类推。
scanf("%s", input)
中,input
前不需要加上&
。 - Rohan