What is the difference between C and C Plus Plus

Interview Questions

What is the difference between C and C++

  • C++ is object oriented while C is function or procedure oriented.
  • C requires all the variables to be defined at the starting of a scope whereas C++ allows the declaration of variable anywhere in the scope.
  • C doesn’t support exception handling directly whereas C++ supports exception handling using try and catch block.
  • C programs uses top down design approach where as C++ programs uses bottom up design approach.
  • C programs are divided into modules and functions whereas in C++ programs are modeled as classes and objects.
  • C program files are saved with .c extension where .cpp extension is used for C++ program files.
  • C uses scanf & printf while C++ uses cin>> & cout<< as their respective input & output functions
  • In C, importance is given to the steps or procedure of the program whereas C++ focuses on the data rather than the process.

What is the difference between C and Java Programming Language

  • Java is object oriented while C is function or procedure oriented.
  • Java is an Interpreted language while C is a compiled language.
  • C language is middle level language whereas Java is high level language.
  • Java does not contain struct and union data types like C.
  • Java does not support pointers like C.
  • Java does not have ‘goto’, ‘typedef’ and ‘sizeof’ keywords and statements.
  • C requires all the variables to be defined at the starting of a scope whereas Java allows the declaration of variable anywhere in the scope.
  • C doesn’t support exception handling directly whereas Java supports exception handling using try and catch block.
  • C programs uses top down design approach where as Java programs uses bottom up design approach.
  • C program files are saved with .c extension where .java extension is used for Java program files.

What do you mean by programming language. Explain with examples.

A programming language is a language designed to communicate instructions to a computer. Programming languages can be used to create programs to control the behaviour and output of a machine. Programmers writes instructions that a computer can understand to perform a specific task as per our requirements. Some examples of Programming languages are C language, C++ language, Python, Perl, Java, C#, Ruby etc.