[Spring Challenge 2026] Error in the default C code

/**
 * Auto-generated code below aims at helping you parse
 * the standard input according to the problem statement.
 **/

That is well and nice but it doesn’t compile:

Standard Error Stream:
/tmp/Answer.c: In function ‘main’:
/tmp/Answer.c:17:9: error: variable-sized object may not be initialized
   17 |         char line[width + 1] = "";
      |         ^~~~

The faulty line being:

    for (int i = 0; i < height; i++) {
        char line[width + 1] = "";
        scanf("%[^\n]", line); fgetc(stdin);
    }
1 Like

Try:

    for (int i = 0; i < height; i++) {
        char line[width + 1];
        scanf("%s", line);
        fprintf(stderr, "%s\n", line);
    }

If you haven’t fixed it already :slight_smile:

Thanks. The point of my post was mostly to point out the fact the code generator was wrong :slight_smile:

Thank you for reporting this.

I will change the code template to use loop height read line:string(30) - resulting in char line[31] = "";.

Will be deployed in a few hours when CodinGame wakes up. Fixed

I figured as much.
But, included a solution in case the fix hadn’t been implemented yet, and you, or others may run into the issue and needed a fix.

@eulerscheZahl But the fix has arrived. :slight_smile: Thanks eulerscheZahl.