Click to See Complete Forum and Search --> : Learning C?


DuneBug
06-29-2001, 09:11 PM
I was just curious about what everyone here thought. Is it worthe while to learn C before learning C++? Or is it just as easy to go and learn C++ right away?

I understand that C++ is based on C, but is Java as well? If so, would I be able to pick-up on Java fairly easily if I learned C first?

And my last few questions:
Is the book, "The C Programming Language" a good book to LEARN C? C would be my first major programming language that I would learn, so far I really only know QBasic, and I was curious if I would be able to understand this book, or if it would be over my head?

For all of you who answer this, thanks a lot! It would be extremely helpful for me if anyone took the time to answer these questions!

P.S. I'm asking these questions because I would like to eventually learn C++. I'm in no hurry to learn this language fast, but the sooner I can start, the better.

DuneBug

alienrash
06-29-2001, 11:24 PM
The basic construct of C or C++ is easy. Its when you start dealing with pointers is when it can get very interesting. Java is a lot easier to program in vs C/C++ in that it does not have pointers at all. If you know how to deal with complex pointers and or data structures you will miss that ability to manipulate them in Java.

They all have their strengths and weaknesses. To get a good feel for OO I would start with Java and then go to C++. It really depends on what kind of challenge you want.


------------------
Blueskies Blackdeath

Zoma
07-01-2001, 01:23 AM
I'm a HUGE advocate of learning C before C++, especially for someone has only programmed in QBASIC (especially x 2 if you used GOTO statements instead of QBASIC's structured programming).

Learning C++ first will make things difficult. You won't really understand how '<<' and '>>' work, and you'll be inexperienced with printf and other functions that use formatting specifiers. I really don't know anyone that uses >> or <<, anyways http://www.sharkyforums.com/ubb/smile.gif

Seriously, C++ is easier to learn than C (well, at least to learn the basics), but it is the dark side http://www.sharkyforums.com/ubb/smile.gif Learning C first will help you understand what is really going on. For example, memory allocation using "new" in C++ is fine, but you'll never really learn what an array is, because you just use "x = new int [100]", and bam you have an array of 100 integers. C makes you actually use the number of bytes and tell it what kind of pointer you want http://www.sharkyforums.com/ubb/wink.gif

One of the two main reasons to learn C first is because C is a structured language, while C++ is an object oriented language. This basically means that C is easier to use, but C++ lets you do some cool stuff that C doesn't http://www.sharkyforums.com/ubb/smile.gif Learning C++ first will just throw extra stuff in there that makes everything weirder than it really is.

The second main reason is because C is a subset of C++, and it is important to know where they differ. If you ever need to write a C-only program, you'll need to know the difference. It's a lot easier to see the difference if you learned C first, because you'll recognize the C++ stuff as stuff you didn't use until you learned C++. Most of it is pretty obvious, but a few things are not (eg, struct and variable declarations that aren't at the top of a function).

Java really isn't based on C, but it looks a bit like C, because they wanted people to use it, and programmers mainly use C. Any language will be easier to learn if you learn C. Pretty much everything that people use is structured, so once you learn how structured programming works, other languages take a very short time to learn. Java is an OOP, so learning C++ before Java makes it even easier. Basically, someone who has been programming in C for a while will be able to learn another language in a few hours. For example, I started editing PERL code before I ever read a thing about PERL, because it looks and (in a basic sense) works just like C. Granted, I had some questions about some things, but other than REs (funky PERL junk), it was just like using C. Well, there were some tricks to be learned, but you get the picture that I was able to understand what was going on without having to start from scratch and read a big book.

I'm not sure if K & R is a good book to use to learn, because I still haven't picked up my copy. It can't hurt, but I'm not sure how technical it is. I think that "C For Dummies" is not a bad series, albeit too slow-paced for my tastes. Check Amazon to see what C books get good reviews. I'm sure the folks at gamedev.net only recommend good C books, as well.

I guess what I'm trying to get across is learn C now, and use it until you get real comfortable with it. Learning C++ is inevitable, but I'd put it off until after you have a decent mastery of C.

DuneBug
07-01-2001, 01:33 AM
Thanks for the reply Zoma. You reinforced the ideas I already had from reading various things on C. It seems as though learning C will benefit me more than going straight into learning C++. Now, I just need to find a good learning book. I figure, if I do get the book, "The C Programming Langauge," even if it is a little over my head now, it will at least be a good reference and reinforcement learning book later.

Thanks for the advice!

maha_x
07-02-2001, 08:50 AM
Definately C. C++ is an EXTENSION of C (thus C++ <- notice + signs). Starting with C gives you an basic understanding of the most basic mechanics in programming. Going to C++ after is more easy as you allready understand about structures and so on. Ones youre done with C++ and OOP you have basically learned Java as well. Java syntax is much identical with C++, only some differences with higher level datatypes and more persistant objectification. Little stuff once you know C/C++. Also, getting into C and the "programming mechanics" will allow you to learn new languages quickly and efficiently.

------------------
__
Yep, I'm one of them