+ 1
is there any difference between header files in c and c++
2 Answers
+ 15
In C, most header files would have their extensions included. E.g.
<stdio.h>
<stdlib.h>
while C++ utilises the same header files with different titles:
<cstdio>
<cstdlib>
Generally, some C headers are deprecated in C++, and new headers which doesn't exist in C were also added to C++.
+ 9
To add to Hatsy Rei's wonderful answer, in C header files you would normally only have declarations and not definitions of functions, external variables, and like wise. In other words, you would declare a function without it's body in a header, then redeclare and define the function (this time with the body) in what ever file the function should be defined. Remember, you only need to define it once. While headers are used in C++, it is actually not recommended to use them in modern C++. By a professional stand point, it is considered bad Programming to use them in C++. You can still do it though, there's just kind of no need to do it in C++. I don't want you to be called a "Script Kiddy" by the pros, you know ; ).