洛谷上的一题,但我为什么连输出都没有?

img


难道是因为函数没有返回值吗,为什么引用函数后,就输出不了了QWERASDZFXCVTGVBHYNUIMKOLPJ

img

这题目是怎样的?

帮你改了一下,你先看看:

#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;
}