Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

C and C++

Posted on 2000-03-27
2
Medium Priority
?
363 Views
Last Modified: 2011-09-20
What's the difference between C and C++.  If i was to write a simple subtraction or addition code. Would the code in C be the same as in C++?
0
Comment
Question by:cooljam23
2 Comments
 
LVL 4

Accepted Solution

by:
feenix earned 150 total points
ID: 2661066
C++ is an object oriented language, C is not. That is the main difference between the two.

You can use the same functions in C++ as in C and you can compile the C source with a C++ compiler. Probably you will just get some more detailed error messages for some cases because C++ is more strict in certain things.

So, yes, the addition and subtraction codes would be the same. Even if you wrote a program that calculated something more complicated, the code would be the same. It might be encapsulated in classes in C++, but basically the same.
0
 

Expert Comment

by:itsimonchan
ID: 2688923
For simple code, I personally suggest to use C for efficiency and simplicity. But for more complex system, I suggest C++. I wrote a system in C with serveral thousands of lines of code for higher efficiency. The price paid is I need to spend much more time to debug and refactor my codes. So, be careful for choosing between OO and non-OO language.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
When you discover the power of the R programming language, you are going to wonder how you ever lived without it! Learn why the language merits a place in your programming arsenal.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Introduction to Processes

886 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question