What is the difference between a .c and .cpp file?

8

C and C ++ are two different languages, however C ++ is a superset of the C language.

So what's the difference between a file with the extension in .c and .cpp ?

    
asked by anonymous 01.12.2016 / 22:24

1 answer

6

Nothing computes to be, but by convention, even usually understood by default by some compilers that .c is C language code files and .cpp is for C ++. Just as many people use .h for C ++ header, others prefer .hpp . There are those who use .cc for C ++ according to comment below Brumazzi DB, also by pure convention.

Note that C ++ is almost a superset of C, there are some small differences, especially if you consider C11. And even though much of what works in C, it is recommended not to use it in C ++.

    
01.12.2016 / 22:28