I’m following a guide to learn curses, and all of the C code within prototypes functions before main(), then defines them afterward. In my C++ learnings, I had heard about function prototyping but never done it, and as far as I know it doesn’t make too much of a difference on how the code is compiled. Is it a programmer’s personal choice more than anything else? If so, why was it included in C at all?
I’m following a guide to learn curses, and all of the C code within
Share
In C prototyping is needed so that your program knows that you have a function called
x()when you have not gotten to defining it, that wayy()knows that there is and exists ax(). C does top down compilation, so it needs to be defined before hand is the short answer.