FreePrograms

  CONTACT US   ABOUT US   PRIVACY  DISCLAIMER

C Language Tutorial with Free C Programs

FREE C PROGRAMS 

What is C C vs C++ vs Java Program Structure Data Types in C Basic Rules of C & C++
Functions in C If, Else Conditions Loops in C Switch Case Arrays
Pointers Structures in C Strings in C Command Line Arguments Type Casting
Linked Lists Recursion Binary Trees Inheritance Multiple Inheritance
Templates File I/O Object Oriented Programming Data Structures in C C interview Questions

C VS C++ VS JAVA: - C Programming Tutorial

C VS C++

The main difference between C & C++ is the OOPS (Object Oriented Programming) concept in C++.

This makes C++ much more efficient than C Language. C is procedure oriented language and c++ is object oriented language. But basically it depends on the project  to project which language to choose from C or C++.

C language's syntax is very easy as compared to C++.Another Difference is that C uses Top Down approach and focuses on procedures.

In it Data moves as such whereas in C++ uses the bottom up approach and focuses basically on data . There is Data Hiding what we call as data abstraction.

Dynamic memory allocation in C is by calloc() and in C++  by malloc() by new and delete respectively. In C we only able to declare the variable in global declaration part, but in C++ it is possible to declare a variable in anywhere in the program.

This is a big advantage of C++ over C because it saves our time while coding. Function prototyping is optional in c whereas it is compulsion in c++.

Sample Syntax for C & C++

C++: -
cout << "Enter two integers"; 
cin >> v1 >> v2; 

C: -
printf("Enter two integers"); 
scanf("%i %i", &v1, &v2); 

In C, we cannot use template and template class. C source code file name should be *.c and *.h for implement file and header file.

Class is not supported in C, so you should convert all of class definition in C++ to structures and functions in C. C++ supports inheritance, polymorphism &  encapsulation & C doesn't.  

Access specifier in C is public, whereas in  C++ it is private. C++ has more keywords than C.

Developers: 

C:  Dennis Ritche in 1972. 
C++: Bjrane Stroustrup in 1980s

C++ VS JAVA

On the Other hand, Java  is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java platform.

It has no preprocessor.

If you want to use classes in another library, we have to import with name of the library.

There are no preprocessor-like macros.

Java uses packages in place of namespaces.

There are no Java pointers like in the  C and C++.  

There are no destructors in Java. Java has constructors, similar to constructors in C++.  

Java has method overloading that works similar to C++ function overloading.

Java does not support default arguments.

There’s no goto in Java. Java has no templates.

Inheritance in Java is similar as in C++, but the syntax is different.

© COPYRIGHT 2009 ALL RIGHTS RESERVED FREECPROGRAMS.COM