Does it matter if a user-defined function is defined before main() or after in C?
If you define function after main() then you must provides it's prototype before main() first, ( so then after main , you can provide defination ). Otherwise compiler give you warnings...
I personally prefer to first declare the functions (declaration is the same as prototype), then define the main() function and then define all the functions after main(). This is because if someone is reading your code, they can get the basic idea of what the functions do by looking at their prototypes and then go to the main() function without reading the, sometimes long/complex function definitions. This adds to the readability of the code as a whole Note that this is only valid when you're working with only one file. When you're making bugger applications, you will give the function declarations in one file, define them in a separate file, and have the main() in another file.
Its doesn't matter becz your execution always start from main function . but it will be good practice if u defining function prototype and if u want to save your time then make function before main in this case here you don't need to do prototyping.
Thinking in the context of large programs : Safer to use prototypes and it's a good practice for *larger* programs. Makes better readability. It's recommendations only..
Thank you for replying, so in conclusion is it safer to define function before main?