char mat[][]; scanf("%ld%ld",&n,&m);
for (i=;i<n;i++)
scanf("%s",mat[i]);
//字符串不会读入' '和'\n',
//这样做可以忽略输入中的空格和空行,c语言中字符串会忽略空格和空行,但字符却不会
如果需要对字符进行处理
char mat[][];
while (xx)
{
scanf("%ld%ld",&n,&m);
for (i=;i<n;i++)
{
scanf("%c",&c);
for (j=;j<m;j++)
{
scanf("%c",&mat[i][j]);
if (mat[i][j]==xxx)
{
……
}
}
}
}