/* * sample-compile-error.c: THIS FILE DOES NOT COMPILE, ON PURPOSE. * Free sample from 99helpers.com/file-types/c * * Use it to test how an editor, CI log, build server or error parser shows * compiler errors. It contains three of the most common C mistakes, marked * A, B and C below. Fixed versions are in the comments next to them. * B is an error in GCC 14 and later and in Clang 16 and later; older GCC * versions only warn about it. * * cc -Wall -Wextra -std=c17 sample-compile-error.c */ #include int main(void) { int total = 42; printf("Total: %d\n", totl); /* A: a typo, so an undeclared identifier. Fix: total */ print_report(total); /* B: a function called without a declaration. Fix: declare it, or #include its header */ puts("Done") /* C: a missing semicolon. Fix: puts("Done"); */ return 0; }