Thursday, July 30, 2009

What is different between C and C++?

Can I use C++ compiler for programming C. whether its give wrong solution

What is different between C and C++?
C





A high-level programming language developed at Bell Labs that is able to manipulate the computer at a low level like assembly language. During the last half of the 1980s, C became the language of choice for developing commercial software. C, and its object-oriented successor C++, are used to write a huge variety of applications and almost all operating systems. There are C/C++ compilers for all major operating systems and hardware platforms. C was standardized by ANSI (X3J11 committee) and ISO in 1989.





C++





An object-oriented version of C that has been widely used to develop enterprise and commercial applications. Created by Bjarne Stroustrup, C++ became popular because it combined traditional C programming with object-oriented programming (OOP) features. Microsoft's Visual C++ is the most widely used C++ language.
Reply:C++ is object oriented. You can define classes.





You may mimmick object oriented programming with plain C, but is a little bit more complicated.
Reply:You can definitely use a C++ compiler to compile a C program. C++ is just an extension of the C language, that supports Object Oriented programming.
Reply:C++ is an increment over C (++ is an increment operator). The main difference is that C++ is a partial Object Oriendted programming Language. C++ compiler supports Basic C syntexes as well as OOPs features like Inheritance, Polymorphism, Data Abstraction etc etc. I suppose, C compiles may not support OOPs features.


U must add (include) proper header files. And remember to save it with a proper extention (.c for C programms and .cpp for C++ programms)


U can refer Kanitkar's Let US C %26amp; Let Us C++
Reply:You can certainly use C++ compiler to C programs. The difference is that C++ supports object oriented programming. Any wrong solutions you may be getting is because of a conflict in the program itself not the compiler.
Reply:two little plus signs. do i win the prize?
Reply:ok.. i am telling u


1. C with claasses hence C++


2. C++ provides data abstraction,encapsulation,inherentence and polymorphism concept.


3. C is top down programming approach.


C++ is bottom up programming approach.


4. In C Structure u can not declare function where as in C++ u can declare function(like classes)


5. C is faster then C++


C++ is generally slower at run time and much more slower at compile time.


6. In C does not have class/object concept.





that's all my dear hope u got it(onlykeshu@yahoo.co.in)
Reply:Hello. - Links Below.





Have a nice day. :)
Reply:You should be able to use a C++ compiler to program C and vice versa as most decent C++ compilers have a backwards compatibility in a sense.





There are certain things to watch out for and ways to do things in order to ensure the compatibility and correct syntax etc. Check this site http://developers.sun.com/prodtech/cc/ar... for an overview of this subject.





Good luck with your programming


No comments:

Post a Comment