Simvik

Fix a compiler error

Read an error message and repair the code. An easy embedded C problem (First steps in C), run and graded in the browser.

easy · First steps in C · syntax · debugging

This function is meant to return twice its input, but it does not compile. Press Run, read the error message and the line number it points to, then fix the code.

Reading compiler errors is a skill you will use every day.

Starter code

int double_it(int x) {
  return x * 2
}

Example tests

Doubles a positive number

printf("%d\n", double_it(4));

Expected output:

8

Doubles a negative number

printf("%d\n", double_it(-3));

Expected output:

-6

Learn it first

More First steps in C problems