Originally Posted by
c_lady
Header file - Wikipedia, the free encyclopedia
Search: "One drawback of this method is that the prototype must be present in all files that use the function. Another drawback is that if the return type or arguments of the function are changed, these prototypes will have to be updated. "
I cannot understand this part... -> Another drawback is that if the return type or arguments of the function are changed, these prototypes will have to be updated.
How prototypes will have to be updated??? PLEASE HELP...
Ok lets say you have a .h header file with the following...
Code:
int GatherIdeas(int a, int b, int c);
and your code has the following...
Code:
int GatherIdeas(int a, int b, int c)
{ return (a * b) / c; }
Now in the process of developing your code you discover you would be better off with a floating point value as a return... If you change the function in your code, you also have to change it in the header file. If you don't the compiler is going to give you errors about "redefinition of function" and such because it no longer knows which version to believe.
Header files have their place. No complex project could be written without them... but function prototypes and function calls in your code do have to match.