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

Asked

Viewed 3,616 times

10

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

So what is the difference between a file with the .c and .cpp?

2 answers

9


Nothing requires to be, but by convention, until usually understood by default by some compilers, that .c be C language code files and .cpp is for C++. Just like many people use .h for C++ header, others prefer .hpp. Some people use .cc for C++ as per comment below the Brumazzi DB, also by pure convention.

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

  • 1

    All we had to talk about were the files .cc, also used for c++.

  • Yeah, some people do.

-1

The difference is only by convention. Some like to use .cpp to differentiate from a C Language file.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.