index, 索引号, 一般从0开始计数。返回的是字符数组下标中从0开始计数,每一位中的内容。
const char *map[4] =
{
"A maple is a carnivore",
"A maple is a pianist",
"A maple is a tree",
"A maple is a game"
};
int index;
if (ch == 'c')
index = 0; //index等于n,就返回字符数组下标中的n+1行中的内容
else if (ch == 'p')
index = 1;
else if (ch == 't')
index = 2;
else
index = 3;
//每当字符ch=c,也就是index=0,就返回上面char字符数组中的 第一行 "A maple is a carnivore",