You've discovered the basic computing concept that the file name and extension actually has no bearing whatsoever on the file contents, or the type of information encoded in the file. You can rename cats.png as cats.doc all you want, but that does NOT make it a Word document containing an informational report on feline companions. It will still be an image file in the PNG format, it's just named incorrectly to look like a Word document. Your OS will probably be confused if you double-click on it, but the contents of the file are unchanged and the word processor app that launches when you double-click will probably give you an error dialog.
You did exactly the same thing. You took a Libre Office document file, which is basically a Word document (actually Word can open it as well, these days) with all the formatting information, table of contents, and whatever else may be included, and then renamed it to ".c", leaving all that information intact. The compiler expects plain textual data, with none of that other information.
File extensions are a useful convention to give the user hints as to what might be inside, and also to give the OS hints as to which program to use to view the file content. But they mean nothing more. That's why you needed to actually create a plain-text document, using a plain-text editor, rather than use a Word Processor and rename the file to lie to your OS.