← The Compilation Pipeline & Reading Compiler Errors

Fix: Undefined Reference

medium

main calls square(n), and square is declared above it – but never defined anywhere in the file. Submit this as-is first and read the error you get: it will look nothing like the syntax errors from the previous exercise, because this program compiles just fine. It fails one stage later, at link time.

Fix it by adding square’s definition (it should return n * n) anywhere in the file below its declaration.

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