在 C 中,我想知道是否可以使用 anint
作为计数器从我的数组列表中选择一个数组。如果不是,你会如何建议解决这个问题?抱歉,代码可能会更好地解释它:
编辑:对不起,我应该澄清说 inputchar 是单个字符,我试图查看 inputchar 是否是数组中任何单词中的字母
int i;
char word0[] ={'c','a','c','h','e'};
char word1[] ={'i','n','t','e','l'};
char word2[] ={'e','t','h','e','r','n','e','t'};
char word3[] ={'g','i','g','a','b','y','t','e'};
char word4[] ={'l','i','n','u','x'};
for (input = 0;input<i;input++)
{
if (inputchar==word(i)[input] /*this is the problem here, i want to use the int (i) to chose the array, i is randomized before this in the program */
{
w(i)[input]=inputchar;
lc++;
printf("You guessed correct! continue on word master");
}
}