Afaceri Start Up">
C VS C++ FULL COMPARISON
We all know that c and c++ are the most famous and most used programming languages ever created . Here i am going to do comparison between these 2 Top programming languages .
1. C Programming language
2. C++ programming language
1.C is a procedural programming language .
2. C++ is an object oriented flavour of c programming language .
1. C was developed by dennis ritchie in 1972.
2. C++ was developed by Bjarne Stroustrup in 1985 .
1. C uses stdio.h as its main header file .
2. C++ uses iostream.h as its main header file .
1. C uses functions like printf() and scanf() As their respective I/O functions .
2. C++ uses cout<< and cin>> like Functions as their respective I/O .
1. C has Static, Weak typing discipline .
2. C++ has static, strong, unsafe, nominative Typing discipline .
1. C was influenced by programming languages such as B (BCPL,CPL), ALGOL 68, Assembly etc.
2. C++ was influence by LAnguages such as C, Simula, Ada 83, ALGOL 68, CLU, ML etc.
1. Languages like awk, csh, C++, C#, Objective-C, BitC, D, Concurrent C, Java,JavaScript, Limbo, Perl, PHP are influenced by C.
2.Languages like Ada 95, C#, Java, PHP, D, Aikido are influenced by C++.
1.GCC, MSVC, Borland C, Watcom C etc . are the major implementation of C language .
2.GNU Compiler Collection, Microsoft Visual C++, Borland C++ Builder, Intel C++ Compiler, LLVM/Clang are the major Implementation of c++.
1. C supports manual garbage collection which allows better management of memory.
2. No Garbage collection is normally Supported by C++.
1.C applications are faster to compile and execute than C++ applications .
2. +-5% when compare with C if you know how to make a good use of C++.The performance of C++ and C are equal, since compilers are mature.
1. C uses .c as its main file extension .
2 . C++ uses .cpp as its main file extension .
1. C proved very useful in running applications coded in assembly language because of its strengths like a simple compiler, lower access levels of memory, lower run time support and an efficient constructing language that was in sync with the hardware instructions.
2. C++ is known as a mid-level language. Due to the fact that the C++ comprises of both high-level and low-level language features. Some of the adjectives used to describe C++ arestatic typed, free-form, multi-paradigm and supporting procedural programming.
1 . C doesn't supports OOP facilities like inline functions , polymorphism etc .
2. C++ supports all major OOP facilities .
1. C doesn't supports Exception handling in standard fashion.
2. C++ supports Exception handling in General fashion .
1.Reference variables allow two variable names to point to the same memory location. We cannot use these variables in C programming.
2. We can use reference variables in C++.
1.Data hiding is not present in C .
2. In c++ data hiding can be implemented .
1.C is regarded as a low-level language(difficult interpretation & less user friendly) .
2. C++ is regarded as both high and low level language , in common sense middle level language .
1. C uses Top down approach .
2.C++ uses button up approach means
"In case of C, the program is formulated step by step, each step is processed into detail while in C++, the base elements are first formulated which then are linked together to give rise to larger systems. "
1. C is Function Driven programming language .
2. C++ is object driven programming language .
Functions are the building blocks of a C program while objects are building blocks of a C++ program.
1. In c we can't use functions inside structure .
2. In c++ we can use function inside structures .
1. C++ uses namespace to avoid Name collision .
2. In c Such provision can't be made .
What is C++? What are the differences between C and C++?
Ans.: The C programming language was designed by Dennis Pitcher in the early 1970’s (1972 A.D.) at Bell Laboratories. It was first used system implementation language for the nascentUnix Operating System.
C++ was devised by Bjarne Stroustrup in early 1980’s (1983 A.D.) at Bell Laboratories.It is an extension of C by adding some enhancements specially addition of class into C language. So, it is also called as superset of C. Initial it was called as C with class. The main difference between C and C++ is that C++ is an object oriented while C is function or procedure oriented. Object oriented programming paradigm is focused on writing programs that are more readable and maintainable. It also helps the reuse of code by packaging a group of similar objects or using the concept of component programming model. It helps thinking in a logical way by using the concept of real world concept of objects, inheritance and polymorphism. It should be noted that there are also some drawbacks of such features. Forexample, using polymorphism in a program can slow down the performance of that program.On the other hand, functional and procedural programming focus primarily on theaction and events, and the programming model focus on the logical assertions that triggerexecution of program code.
C VS C++ Programs
1) Hello world in c
#include<stdio.h>
#include<conio.h>
void main()
{
printf("hello world"); //print hello world to screen
getch();
}
2) Hello World in C++ ( dev C++ style)
#include<iostream>
#include<conio.h>
using namespace std ;
int main()
{
cout<<"hello World"; //prints hello world to screen
getch(); // wait until user presses any key
}
3) Hello World in C++ ( Old / turbo C++ style)
#include<iostream.h>
#include<conio.h>
void main()
{
cout<<"hello World"; //prints hello world to screen
getch(); // wait until user presses any key
}
Thats for now . Thanks for being with me . Please comment if you have any new differences or something to say .
0 comments:
Post a Comment