Are you sure you are not over-extending the request of your friend?
Looking at the content is difficult:
- not every C-file needs main()
- not every C-file includes stdio.h
The idea to compile the file to see if it runs will also lead to problems:
- what if it is a C-file, which however contains a syntax-error? Probably it should be listed nevertheless...
- what if the C-file needs some non-standard compile options (and compiling fails if you don't provide them?)
- what if it is a simple C++ - program/file, which however compiles with C?
Therefore I would just look at the extensions .c and .h (and possible additional relevant extensions for your domain).