← Build Systems & an Intro to CMake

Fix: Missing Forward Declaration

easy

triple is defined correctly, but after main, which calls it. Submit as-is and read the error – it’s the “implicit declaration” error from the previous lesson, except this time nothing is missing an #include; the function simply hasn’t been declared yet at the point it’s called.

Fix it by adding a forward declaration (a prototype, int triple(int n);, with no body) above main. This is a one-file rehearsal of exactly what a header file does across files: it lets code that comes first refer to code defined later, anywhere in the project.

Your solution

"Run" uses the sample stdin ("4"). "Submit" checks your code against all 3 test cases.

Test results

Submit your solution to run it against all test cases.

Hints

    Reference solution