Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

C and C++

Posted on 2000-03-27
2
Medium Priority
?
358 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 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
Starting up a Project

719 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