In this case, the important thing is not the extension but the content of the file.
A C compiler will only be able to compile C compatible code, while to compile C ++ code you will need a C ++ compiler.
The extensions are not limiting and, for example, nothing prevents you from creating a prueba.c
file that contains a complete program written in ADA ... it is not a good practice but it can be done.
The fact is that you have to look at the content you want to process. If this content is C ++ you will have to use a C ++ compiler, while if the source code is C you can perfectly use a C compiler.