Monday, January 26, 2015

How to differentiate C and C++ program code

If you have learn programming in your school, most probably you will have learn C and C++ language.

There are many differences and similarities between C and C++ languages.
C and C++ share similar syntax.
C have functions, while C++ have classes.
But just by looking at the code, how to differentiate C from C++ code?

One of the most easiest way to identify a C code from a C++ code is by looking at the comment.
In C, comments is denoted by /* comments here */
whereas in C++, comments is denoted by /* comments here */ as well as // comments here
So if you see // in the code of your program, then it must be a C++ code.