Sunday, 22 July 2012

Difference between C and C++ language

1) C is the procedural programming paradigm whereas C++ is a multi paradigm language.
2) C is function driven while C++ is object driven.
3) C uses the top-down approach while C++ uses the bottom-up approach.
4) In case of C++ data is secured but in case of C data is not secured.
5) In C language standard input and output functions are scanf and printf whereas in C++ standard input and output functions are cin>> and cout<<.
6) C++ suppot function overloading whereas C does not suppot overloading of the function.
7) C language is based on unix operating system while C++ is extension of C.
8) In C allocation is done with the help of malloc function whereas in C++ allocation is done with the help of operators.
9) In C namespace feature is absent and in C++  namespace feature is present.

Difference between Recursion and Iteration

1) A function is said to be recursive if it call itself again and again within its body whereas iterative functions are loop based imperative functions.
2) Recursion uses stack whereas iteration does not use stack.
3) Recursion uses more memory than iteration as its concept is based on stacks.
4)Recursion is comparatively slower than iteration due to overhead condition of maintaining stacks.
5)Recursion makes code smaller and iteration makes code longer.