Jump to content

Learning C or C++, which first?


Recommended Posts

I say C first because it forces you to learn things from the ground up, but you don't have to become a professional with it - enough to, say, understand the PHP source code. C++ abstracts out some things that are actually important to know and understand. Things that not nearly enough programmers nowadays know about. Also, get off my lawn.

Link to comment
Share on other sites

Get off your lawn? Lol..

 

Are you able to suggest a good book to start with? I know how to make some simple math programs and such in C++ already.. I have a little bit of knowledge on the basics of C++..

 

I started programming 3 years ago, Started with PHP, now I can do anything I need done with that.. but if you have any suggestions or could point me in the right direction? Thanks!

Link to comment
Share on other sites

Not really - I don't learn with books or tutorials. Any series you've tried before and liked? Head First? O'Reilly? Mosey on over to a bookstore, skim through a few books they have, and see what's out there. There's bound to be one or two that will work well for you.

Link to comment
Share on other sites

Ahh, I forgot about Headfirst .. I own Headfirst Java - Reading that book was a decent experience.. They make it easier to comprehend.. I'm going to look into Headfirst C++ and C. I've got some of the basics of C++ down. I'm self taught in PHP, I've mastered pretty much every aspect of that language.. I don't know why it has taken me 3 years to even initiate trying to learn C++.. In the beginning it was intimidating I guess.. lol now Its not bad at all

Link to comment
Share on other sites

Id say you should just learn C++ without undergoing C training at all. C++ is an object-oriented programming language based on C, the syntax is similar but C++ offers much more advanced features for objects. Moreover, C++ encourages programming in the OO way which can be a problem for hardcore C programmers. If you are so used to coding an application in a pure procedural language, the switch to OOP will be more difficult than it otherwise should be. For absolute beginners procedural programming may be an easier starting point, but it is not really a problem for C++ as it also supports C's syntax. Just make sure you move into OOP right after getting used to basic stuff such as Conditionals, Loops and Functions.

Link to comment
Share on other sites

@Hall of Famer: again, OOP is not inherently superior than procedural.

 

@OP: The real question is what do you want to do with the language(s)?  C is generally used for close-to-the-metal programming where speed and efficiency are paramount.  The linux kernel is written in C, for example.  C++ is generally used for mainstream apps.

Link to comment
Share on other sites

  • 4 weeks later...

@Hall of Famer: again, OOP is not inherently superior than procedural.

 

@OP: The real question is what do you want to do with the language(s)?  C is generally used for close-to-the-metal programming where speed and efficiency are paramount.  The linux kernel is written in C, for example.  C++ is generally used for mainstream apps.

I have to disagree with this.  Having worked with both, the line between the two is blurring.  When it comes to performance, C++ is not that far away from C (but this comparison is absurd since it all depends on the assembler that the compiler is generating).  Yes, C is used more for kernel-level code, but its domain is quickly shrinking and becoming less prevalent to just that area.  Even in the operating system sphere, C++ is showing in areas that were previously written in C.  And yes, you can write a kernel in C++ :) .

 

Also, it depends on your notion of what it means for mainstream apps.

 

OP, learn C++.  The hardest part about C is the concept of pointers, something that C++ already has.  You will have more room to learn new stuff.  Here are a few tutorials:

- http://www.cplusplus.com/doc/tutorial/

- http://www.cprogramming.com/tutorial.html

 

Go through those before you bother with buying a book (cheaper).  Honestly, just dive in, all of the other pieces will fall into place.

 

Lastly, the common mistake newbies make is that they focus on the language and what it -- in theory -- is supposed to do.  If you want to gain a certain mastery (or depending on the direction you would like to head in), make sure to learn some assembler and how the operating system that you're writing against is creating this code.

Link to comment
Share on other sites

Id say you should just learn C++ without undergoing C training at all. C++ is an object-oriented programming language based on C, the syntax is similar but C++ offers much more advanced features for objects. Moreover, C++ encourages programming in the OO way which can be a problem for hardcore C programmers. If you are so used to coding an application in a pure procedural language, the switch to OOP will be more difficult than it otherwise should be. For absolute beginners procedural programming may be an easier starting point, but it is not really a problem for C++ as it also supports C's syntax. Just make sure you move into OOP right after getting used to basic stuff such as Conditionals, Loops and Functions.

:)

 

Most people who are so pro-C and anti-C++ tend to be unwilling to learn something new (yes, some of the older developers tend to be like this at times).  Developing code is about grasping new concepts all the time, so unless you're just unwilling to learn something new, this is a non-concern.

Link to comment
Share on other sites

  • 2 months later...

Ahh, I forgot about Headfirst .. I own Headfirst Java - Reading that book was a decent experience.. They make it easier to comprehend.. I'm going to look into Headfirst C++ and C. I've got some of the basics of C++ down. I'm self taught in PHP, I've mastered pretty much every aspect of that language.. I don't know why it has taken me 3 years to even initiate trying to learn C++.. In the beginning it was intimidating I guess.. lol now Its not bad at all

Head First C was very fun and easy to read. I liked it. Head First C++ doesn't exist. I hope to read Head First C++ when it comes out.
Link to comment
Share on other sites

  • 2 months later...

I couldn't agree more with KevinM1. Which one you choose to learn (first) is completely dependent on your goal. There's no reason why you can't learn C++ first; It inherits everything from C. People seem to think C -> C++ because its a "step up" but in reality its not, its two different languages one being a superset of the other.

Link to comment
Share on other sites

  • 5 months later...

The biggest question is time.  Do you have the time to learn C?  If you're just an unemployed teenager who like programming, I would take the free time that you have an learn C.  In short, it will not hurt you to know C

 

As Kevin mentioned earlier though, it all depends on your needs.  If you're just bored, I would go with C.  if you're looking for a language that you can create a certain application with, learn C++ or C# or Java...

 

Think of it like a vehicle.  C++ would be your ability to add things to the car.  New engine, new stereo system, new alternator, new upholstery , etcetera, etcetera, etcetera...

 

Knowing C would be your ability to tweak of fix these things without even needing a "new" thing.  For instance, say your alternator goes but you just happen to know exactly how to take it apart, change the brushes, make new brushes, whatever.  Battery goes out and you know exactly which chemicals to get to renovate it.  If you get into a fender bender and part of the body of your car is ripped off, leaving a gaping whole, then you would how to weld some old metal to the point that it looks brand new.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.