📅  最后修改于: 2020-10-16 05:57:19             🧑  作者: Mango
C是一种面向结构或过程的编程语言,它与机器无关,并且广泛用于各种应用程序中。
C是一种基本的编程语言,可用于从操作系统(例如Windows)开发到复杂的程序(例如Oracle数据库,Git, Python解释器等)。 C编程语言可以称为上帝的编程语言,因为它构成了其他编程语言的基础。如果我们知道C语言,那么我们可以轻松学习其他编程语言。 C语言由贝尔实验室的杰出计算机科学家Dennis Ritchie开发。它包含一些其他功能,使其与其他编程语言不同。
C++是由Bjarne Stroustrup在1980年左右在贝尔实验室开发的一种特殊用途的编程语言。C++语言与C语言非常相似,并且与C如此兼容,因此它可以运行99%的C程序而无需更改任何代码源。 C++是一种面向对象的编程语言,因此它比C语言更安全,结构更好。
让我们了解C和C++之间的区别。
以下是C和C++之间的区别:
让我们以表格形式总结以上差异。
No. | C | C++ |
---|---|---|
1) | C follows the procedural style programming. | C++ is multi-paradigm. It supports both procedural and object oriented. |
2) | Data is less secured in C. | In C++, you can use modifiers for class members to make it inaccessible for outside users. |
3) | C follows the top-down approach. | C++ follows the bottom-up approach. |
4) | C does not support function overloading. | C++ supports function overloading. |
5) | In C, you can’t use functions in structure. | In C++, you can use functions in structure. |
6) | C does not support reference variables. | C++ supports reference variables. |
7) | In C, scanf() and printf() are mainly used for input/output. | C++ mainly uses stream cin and cout to perform input and output operations. |
8) | Operator overloading is not possible in C. | Operator overloading is possible in C++. |
9) | C programs are divided into procedures and modules | C++ programs are divided into functions and classes. |
10) | C does not provide the feature of namespace. | C++ supports the feature of namespace. |
11) | Exception handling is not easy in C. It has to perform using other functions. | C++ provides exception handling using Try and Catch block. |
12) | C does not support the inheritance. | C++ supports inheritance. |