Tuesday, July 14, 2009

C & C++ (Should I go straight to C++)?

I have just completed the C for dummies book, and it has just recommended me to purchase the C all-in-one reference for dummies, which I have... the book was excellent, and I loved every minute of it, so I have no doubt I shall love the next book (also by the same author)...





Problem is, knowing that C++ is the better (or newer should I say) of the two, should I really spend a great deal of time learning its predecessor?





I will be going straight into C++ the moment I learn everything there is to learn about C, so I won't be missing out in any way. I'm just curious as to whether learning C to such extent will allow me to learn (and understand) C++ any better once I get in to it...

C %26amp; C++ (Should I go straight to C++)?
Yes, C++ is a super set of C. If you can do it in C the same code should compile and run fine in C++. Also there is the added benefit that some programs are written in C not C++, i.e. most OS and device driver work. If all you know is C++ you will have a difficult time working in C. But then again that depends on what you want to do. Part of this is because even though C++ is compatible with C, properly written C++ code looks very different from good C code. A C++ programmer has to deal with exceptions, inheritance and the like, which can make your life very good, and also a bit more confusing.





You really should check out Effective C++ by Scott Meyers, if you want to know how to program well in C++. But a solid understanding of C will not hurt you in any way.
Reply:yes, u will stay in the same logic.. but new horizons would open to you with c++.. after that u can go to the C#..
Reply:OK, as similar as they *seem* on the surface, C and C++ are two different languages. They are generally used for different purposes as well. C is not hard to learn well, it is small and you can do a lot of stuff with it. If you want to code device drivers and OS utilities I would go with that. C++ is used more often these days for more general programming, but is a lot more complicated and can be quite confusing. Knowing C well will not necessarily help you with C++. If you don't plan to use C much, I would just skip to C++ since it seems that's the language you are aiming to learn.





Good luck.
Reply:I've been program in both C and C++ (and C# now) for years. The syntax for all three is the same. If you are comfortable with C then move into C++. It will reinforce what you've learned and introduce to better error handling and OO programming as well.

hamper

No comments:

Post a Comment