What is difference between C and C++ ?


[This is a usual C or C++ interview question, mostly the first one you will face if you are fresher or appearing for campus interview. When answering this question please make sure you don't give the text book type explanations, instead give examples from real software scenario. Answer for this interview question can include below points, though its not complete list. This question itself can be a 1day interview !!!]

  • C++ is Multi-Paradigm ( not pure OOP, supports both procedural and object oriented) while C follows procedural style programming.
  • In C data security is less, but in C++ you can use modifiers for your class members to make it inaccessible from outside.
  • C follows top-down approach ( solution is created in step by step manner, like each step is processed into details as we proceed ) but C++ follows a bottom-up approach ( where base elements are established first and are linked to make complex solutions ).
  • C++ supports function overloading while C does not support it.
  • C++ allows use of functions in structures, but C does not permit that.
  • C++ supports reference variables ( two variables can point to same memory location ). C does not support this.
  • C does not have a built in exception handling framework, though we can emulate it with other mechanism. C++ directly supports exception handling, which makes life of developer easy.


© 2017