I am getting an error that says undeclared identifier.

It is on the line

if (answer[i][j] == ' '){
            answer[a][j] = '*';

I have attached a good chunk of the code if you need more please let me know.

Thanks.

int main(void) {
    char answer [100][48];
    int count;

    count= GetInput(answer);
//    printf("total lines read= %d\n", count);
    OutputResult(answer, count);

    return 0;
}

int GetInput(char answer[100][48]) {
    char c; // store char read in
    int i; // row
    int j; //column

    SkipLine();
    for (i=0; scanf("%c", &c) != EOF; i++) {
        for (j=0;j<48;j++){
            scanf("%c", &answer[i][j]);
            if (answer[i][j] == ' '){
                answer[a][j] = '*';
            }
        }
        SkipLine();
    }

    return i;
}

error: `a' undeclared (first use in this function)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.