Solved

C and C++

Posted on 2000-03-27
2
354 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

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
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 …
Introduction to Processes

624 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