Solved

C and C++

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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
A short article about problems I had with the new location API and permissions in Marshmallow
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

743 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now