English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

7 answers

ready functions are different
printf and cout
scanf and cin

and so on

www.bloodshed.net

2007-07-19 21:03:25 · answer #1 · answered by iyiogrenci 6 · 0 0

The C++ compilers have some added libraries that are not present in C compilers. So you can compile a C code in the C++ compiler but not vice versa.

2007-07-20 04:12:06 · answer #2 · answered by sharad s 2 · 0 0

C++ is almost a superset of C. The main addition is support of object-oriented (classes) and generic programming (templates).

While much C code can be compiled as C++, there are subtle differences so C is not a true subset of C++. That said, it generally takes little effort to modify C code to work correctly in C++.

2007-07-20 12:36:46 · answer #3 · answered by Bill G 2 · 0 0

The language is different. So the compilers are different. To those of you who called C++ only being different on headers and libraries, I want you to replicate templates in C++ in C. Or multiple inheritance. Have fun.

2007-07-20 09:50:19 · answer #4 · answered by csanon 6 · 0 0

The fundamental issue is that of maintaining backwards compatability with C. When Bjarne created C++ (under the old name C with Classes) he wanted to emulate Smalltalk's object model in C. One of the important features Bjarne was adding to C++ was the concept of accessor privelege (private, public and protected.) When those things are added to a language, it is generally done such that private is the default.
In order for code from C to work with C++, the members of a structure would be expected to be public. However, Bjarne knew that default privacy was important. The solution chosen was to clone the "struct" keyword and make this one small change. In fact structs and classes are the same thing; you can inherit structs from classes and vice versa (though it's pretty stupid, it's legal.) The ONLY technical difference between structs and classes is whether members default to private or public accessorship. This can be derived from the language of section 3.1 of the C++ standard (ISO IEC 14882-1998.)

Repeat with me: "The only difference in C++ between struct and class is that struct is default public, whereas class is default private."

2007-07-20 04:12:34 · answer #5 · answered by Anonymous · 0 0

Not much different excepting the Header files and Libraries

2007-07-20 07:16:16 · answer #6 · answered by Anonymous · 0 0

not much difference. just different header files and library.

2007-07-20 05:33:30 · answer #7 · answered by Mukesh S 2 · 0 0

fedest.com, questions and answers