Solved

C and C++

Posted on 2000-03-27
2
349 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 4

Accepted Solution

by:
feenix earned 50 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

Suggested Solutions

In this post we will learn different types of Android Layout and some basics of an Android App.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
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…

710 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