Please tell me what is the basic differences between C and C++?

Recommended Answers

All 7 Replies

Basic difference is
C++ is Object Oriented with classes
and C is not.

Basic difference is
C++ is Object Oriented with classes
and C is not.

Not entirely though like java or c# :)

Well...those links have a lot of the differences. I think basically C++ is an extension of C with added features. You can still use C code in C++, and code in a "C-Style", but C++ has features that do away with some C stuff.

In terms of abstraction from the machine, C is very low level. It was designed to be basically a thin layer over the machine, providing the functionality and sort of direct interfacing of machine-level or assembly-code, but being portable (assembly and machine code is not portable, i.e. it is dependent on the architecture). You should read about the history of C...here is one place to start.

So then, C++ is an extension to the C language. It has added functionality. In particular, it has a rather extensive standard library (compared to C), or rather has an extended library. It also supports the idea of objects and classes, and supports large-scale projects and security better than does C. You should read about the history of C++ as well and read the links provided above to get some of the more technical differences.

Please tell me about some functions that we can not use in C.

Uhhhh well I really was only learning C in school, and am just sort of learning C++ because. Everywhere I look (and from what my profs tell me) you should learn C first, and then learn C++ (easy transition). In terms of actual functions, well:

One thing I noticed right away when I switched was that C++ programmers love to use strings (i.e. the string class) whereas we (the C users) had to constantly be using pointers to characters...aha. Vectors also seem to be used a lot, rather than dynamically allocated arrays or perhaps more suitable custom-designed structs...Another thing (more annoyance really) is that there is no boolean type in C -- just meant you had to #define TRUE and FALSE if you wanted to use them instead of integers. Uhh I also tend to not use the standard library so much, partly because my prof forbade us from using it and made us implement everything ourselves, and also because the C library is not as large..but C++ users (at least the ones here) tend to use STL extensively. Classes are really just structs in disguise (ahaha), but they have some other cool features (that I am still investigating). Ummm there are a lot of other differences, but they are also similar in so many ways. My advice: learn C, and you will know C++ (or the transition will not be difficult). Don't start with C++, because you will probably not want to go back and learn C. :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.