C
|
C++
|
|
|
Can’t run C++ code.
|
Can run most of C
code.
|
|
Language type
|
|
-procedural oriented language.
- Function-driven language.
|
-multi-paradigm language (procedural as well as object
oriented).
- Object-driven language
|
|
Security of the data
|
|
Data is not secured.
|
Data is secured by specific OOP features like Data Hiding.
|
|
Programming language
type
|
|
Low level language:
difficult interpretation and less user friendly.
|
Middle-level language:
-Low-level language: concentration on what’s going on in the
machine hardware
-high-level language: concentration on the
program itself.
|
|
The flow of the
execution
|
|
Uses the top-down
approach in formulating the program.
|
Uses the bottom-up
approach in formulating the program.
|
|
Include library
|
|
#include<stdio.h>
|
#include<iostream>
|
|
Input /output
commands
|
|
-Scanf for input.
-printf for output.
|
-cin>> for input.
-cout<< for output.
|
|
Mapping between data
and functions
|
| Difficult. |
Easy and can be used
by using “objects”.
|
|
Main() function
|
|
Can be called through
other functions.
|
Can’t be called
through other functions.
|
|
Deceleration of
variables
|
|
Requires to be
defined at the starting of the scope.
|
Can be defined
anywhere.
|
|
Deceleration of the
functions
|
| Can be defined anywhere. |
Must be defined
before the are used.
|
|
Library
|
| Smaller library. |
Has much larger
library.
|
|
Dynamic memory
commands
|
-malloc() and calloc() functions for memory allocation.
-free()function for
memory
de-allocation.
|
-new operator for memory allocation.
-delete operator for memory
de-allocation.
|
|
‘Return 0 ‘command
|
It must be added at
the end of the program.
|
It will be provided
automatically.
|
|
String type
|
|
-Doesn’t support string type,you can declare it as an array.
-recognizes only the first 32 char of string.
|
-uses string type .
-doesn’t pose the limit of the string.
|
|
Function overloading
|
|
Doesn’t support
function overloading.
|
Supports function
overloading (polymorphism).
|
|
Reference variables
|
| Doesn’t use reference variables. |
uses of reference
variables.
|
|
Exception handling
|
|
Doesn’t support exception
handling.
|
Supports exception handling
(try and catch block).
|
|
Data types
|
|
Supports built in
primitive data types.
|
Supports built in and
user data types.
|
|
Speed
|
|
Applications are much
faster at run time.
|
Applications are
generally slower at run time.
|
|
File name extensions
|
| .c |
.cc,.cpp,.hh,.hpp
|
|
Compilers
|
|
GCC, Microsoft
QuickC, Borland C, Watcom C.
|
Borland C++ Builder ,
Microsoft Visual C++,Oracle Solaris Studio Express ,GNU.
|
|
Main difference
|
|
Easier to master
,it’s very small language.
|
Easier to learn at
first .
|
