In this Post you know the Difference Between C and C++ and also know about the Introduction of C and C++.
What is C Introduction
C Introduction:- C is a middle-level language. It was developed by Dennis Ritchie. It has the simplicity of a high-level language as well as the power of a low-level language. This aspect of C makes it suitable for writing both application programs and system software. Thus it is an excellent, efficient, and general-purpose language for most the applications such as mathematical, scientific, business and system software applications.
What is C++ Introduction
C++ Introduction:- C++ is an object-oriented programming language and it is also known as the structural programming language. C++ was developed by Bjarne Stroustrup at AT & T’s Bell Laboratory(USA) in 1979. C++ provides so many features such as Array, Structure, class, and object, constructor and destructure, inheritance, polymorphism, containership, encapsulation, sorting, queue, and linked list.
Difference between C and C++
- C Language was developed by Dennis Ritchie in 1972 at AT & T’s Bell Labs.
- C is a subset of C++.
- C supports the procedural programming paradigm for code development.
- C does not support object-oriented programming; therefore it has no support for polymorphism, encapsulation, and inheritance.
- In C (because it is a procedural programming language), data and functions and separate and free entities.
- C being procedural programming, it is a function-driven language.
- C does not support function and operator overloading.
- C does not allow functions to be defined inside structures.
- C does not have a namespace feature.
- C uses functions for Input/Output for example scanf and printf.
- C does not support reference variables.
- C does not provide direct support for error handling(also called exception handling).
- C is a middle-level language.
- File extension in C is. C
- When a function takes no parameter, its prototype has the word void inside parenthesis.
- In C, prototypes are recommended but technically optional.
- In C, a nonvoid function is not required to actually a value. If it doesn’t, a garbage value is returned.
- In C, comments in the program can be specified by /…./
- In C local variables can be declared only at the start of a block prior to any action statements.
- In C, variables are of two types
C programmer follows a top-down approach for programming. It is a program design technique that starts with the highest level of an idea and works its way down to the lowest level of detail.
/* Write a program of a sum of two nums.
int a=10, b=20, c;
- C++ was developed by Bjarne Stroustrup in 1979 with C++’s predecessor “C with classes”.
- C++ is a superset of C. C++ can run most of C code while C cannot run C++ code.
- C++ supports both procedural and object-oriented programming paradigms; therefore C++ is also called hybrid language.
- C++ supports Object-Oriented Programming therefore C++ supports polymorphism, encapsulation, and inheritance.
- In C++ (as an object-oriented programming language), data and functions are encapsulated together in form of an object.
- While C++ is object-oriented programming, it is an object-driven language.
- C++ supports both function and operator overloading.
- In C++, functions can be used inside a structure.
- C++ uses a namespace that avoids name collisions.
- C++ uses functions for Input/Output for example Cin and Cout.
- C++ supports reference variables.
- C++ provides support for exception handling. exceptions are used for “hard” errors that make the code incorrect.
- C++ is a high-level language.
- File extention in C++ is .CPP
- However, in C++ the void is optional .
- In a C++ program, all functions must be prototyped.
- In C++, if a function is declared as returning a value, that is return type other than void, any return statement within that function must contain a value.
- In C++, due to backward compatibility, /…/ is still used for multiple line comments. We can also make a single line as a comment by prefixing that line by //
- In C++ local variables can be declared anywhere in the block.
- In C++, variables are of three types
- C++ programmer adopts bottom up approach for programming.
/* Write a program of sum of two number.
int a=10, b=20, c;
I hope you like today’s article, Difference between C and C++. If you have any queries or suggestions ask us in the comment below.
You can also join us on social media, share this article with your friends or families, and don’t forget to subscribe to it.
STAY HAPPY STAY HEALTHY