这题目是怎样的?
帮你改了一下,你先看看:
#include<stdio.h>
int p(char **b, int i, int j);
int main(void) {
int x, y, i, j, c[200][208];
char a[200][200], b[208];
scanf("%d %d", &x, &y);
for (i = 1; i <= x; i++) {
b[i] = a[i];
}
for (i = 1; i <= x; i++) {
scanf("%s", b[i]);
}
for (i = 1; i <= x; i++) {
for (j = 1; j <= y; j++) {
c[i][j] = p(b, i, j);
printf("%d", c[i][j]);
}
}
printf("%d", count);
return 0;
}
int p(char **b, int i, int j) {
int count = 0;
if (b[i+1][j] == '*') count++;
if (b[i+1][j+1] == '*') count++;
if (b[i+1][j-1] == '*') count++;
if (b[i-1][j] == '*') count++;
if (b[i-1][j+1] == '*') count++;
if (b[i-1][j-1] == '*') count++;
if (b[i][j-1] == '*') count++;
if (b[i][j+1] == '*') count++;
return count;
}