main.c vs project.c
When creating a new project that is only one '.c' file,
Should it be named: project.c or main.c ? Please advise |
It doesn't matter what the filename is. You only need to make sure the main() function is declared in one of your project files. Which file and what filename is compltely arbitrary.
|
Still need an answer
I know that both would work, I'm trying to establish what the standard is?
For configuration management purposes, and traditional c practices, should the main function be house in main.c or project.c ? Or is it still a matter of preferance? Please advise. |
Name it with the name of your program. (eg MyApplication.c)
|
There's no standard, it's just a matter of preference.
|
Preference, but in most cases program name is used.
|
There is no standard, but using the same name as the program name has an advantage: you can compile your very simple project with the make command without having to write a Makefile. For example, if you saved the "hello world" program as hello.c:
Code:
make hello |
All times are GMT -5. The time now is 03:02 AM. |