Skip to the task
Layout
Back to classic view

You are looking ahead. Your place is still task 1: Algorithm.

CHECKTask 9 of 21 · step 4: An algorithm as a sequence of statementsRead the error: prinft
Read the error: prinft in practice/01/

Write prinft instead of the first printf and click ▶. Why did a warning become an error, and what does GCC suggest?

Details & hint
C:/.../practice/01/main.c:4:5: error: implicit declaration of function 'prinft'; did you mean 'printf'? [-Werror=implicit-function-declaration]
    4 |     prinft("Hello, world!\n");
      |     ^~~~~~
      |     printf
cc1.exe: all warnings being treated as errors

Two rules: fix the first error (the others often go away with it) and read the whole line (the answer is often already there).

Stuck? The compiler does not know a function called prinft and suggests printf. It is a warning, but -Werror (the last line) turns every warning into an error. Put printf back.

practice 01 main.c Code Diff +6
M · MODIFIED git diff: red = old code, green = new.
--- a/practice/01/main.c
+++ b/practice/01/main.c
@@ -2,5 +2,11 @@
int main(void) {
printf("Hello, world!\n");
+ printf("\n");
+ printf("Algorithm: the average of grades\n");
+ printf("1. Add up all the grades.\n");
+ printf("2. Count how many grades there are.\n");
+ printf("3. Divide the sum by the count.\n");
+ printf("4. Print the answer.\n");
return 0;
}