-
whats best c or c++
Hi all!!
real simple question from someone who wants to be as clever as all of you!
I'm a month into learning c but i'm beginning to wonder if i should learn c or c++. I'm looking for a future in IT and programming if i can, so which is best?
Is c old hat or is it the equal of c++.
whats the difference between them?
-
I wouldn't call C old hat. For me, C is a release - C++ has been getting on my nerves recently.
You could have (should have?) googled for this - would've been quicker than waiting for an answer from here (not that I answered the question).
-
I don't know whether or not there IS a correct answer to that question...
-
Not that this thread hasn't happened before. :rolleyes:
-
sorry guys!!!
dont mean to be annoying but i dont know why there are different types of c.
what are the advantages of one over another?
are there any?
is it better to learn c before taking an interest in c++? :confused:
-
when i started C++ i found it more easy becuase i am well advance with javascript and in some strange way C ++ to me is a bit like js
-
There used to be different types of C, and then the language was standardized to ANCI spec. Most C compilers are not up to the latest ANCI version, some of the improvements of this version are thought by some to be unnesecary.
As to whether you should learn C or C++, you should first understand the differences between the two, namely, understand OOP. OOP provides features to encapsulate code to make it more modular and extensible, thats all it does. Leaving out the OOP in C++ youre left with a language almost the same as C, but with more safeguards and better type checking. Some would say the permisive syntax in C gives better leeway to a programmer who knows what he/shes doing. In the end, the OO features cost a bit in overhead, which is why speed critical code is still done in C. But you have to be honest with yourself, as a beginner these differences in speed are not going to be an issue, so really, in my opinion, your choice of first language should be what teaches you the most. If you are a self learner, I recommend Java. Java has all the OOP features of C++, but leaves out all the low level features that overwhelm a beginner. After Java then learn C to learn the low level features. Then you will know C++ automatically because Java and C have everything C++ has.
-
"ANSI".
Holy wars have been started over this subject. I personally like the OOP aspects (classes) of C++, but if I can fall back to C, I will. (Usually for simple/small projects.) C++ isn't always available if you come across some exotic platform. (Which I have... but it was all fun.) Pick whatever language will best suit the project, in terms of speed (running the app), speed (developing the app), cost, availability, knowledge of others that might work with you, etc.
Haven't yet been able to stomach Java. Ironically, it was the first real programming I ever learned.
-
Here's a few links you should see IMO:
Bjarne Stroustrup's C++ page
His FAQ
This FAQ in particular
Now for my own opinion (NOT FACT):
>>I'm looking for a future in IT and programming if i can, so which
>>is best?
I would recommend C++ for the following reasons:
1) Companies like C++ because it's a good alternative to java,
code can be highly portable and it executes pretty fast - faster
than java compiled to bytecode (technical stuff - not too
significant if you don't know what I'm saying)
2) Object orientated languages suit such business, but they have
the feature of bulking up program size - C on the other hand is
more basic - the array of features that C++ has over C is immense
but if you were programming a microcontroller, manipulating raw
data, and you need it done efficiently, then C is the way to go.
They way I generally look at it is: Use C if you want really specific
control of a system (the Linux kernel is written in C, as is the
Windows kernel I think), but use C++ if you want to work on a
project that requires a lot of versatility from the language you
use.
>>Is c old hat or is it the equal of c++.
C is not the equal of C++ - although it is possible to reproduce
OOP features in C, there is no point in my opinion when C++
handles it much more easily. Similarly, there is no point in
programming a washing machine using classes, inheritance,
templates and all the other massive features C++ offers. My point
is that the right programming language makes all the difference,
and a lot of the time C still holds ground.
Lastly, if you do want to go into programming as a career, you
shouldn't limit yourself to choosing between C and C++, but
rather learn both - and a few other languages while you're at it.
Apparently java is easy enough to pick up if you come from a C++
background, and in my experience, if you learn C well (and don't
pick up bad habits), C++ is an easy step to make. As Stroustrup
says, "Well written C tends to be legal C++ also"
-
This thread should have had only one reply post and one answer: C++ is a better C, which doesn't necessarily mean C++ is better than C.
-
thanks for all your answears guys!!!!
it really is appreciated :D
-
Depending on where you end up in the IT field you wont even use C/C++. I am a programmer and use C++ for almost all my home projects, but at work I use Perl, PHP, Java, SQL and *SHUDDER* Jython. Focus on one of then languages, the language you understand best at the moment, then branch out to other languages... my C++ background helped me a lot in learning other languages, just as those other languages have made me understand some things in C++ better :D.
-