Page 1 of 2 12 Last
  • Jump to page:
    #1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2002
    Location
    Huntington Beach, CA
    Posts
    0
    Rep Power
    0

    New to Programming (C++ question)


    After ready a few posts similar to mine, I have seen that you guys reccomend C before learning C++. I would just like to comfirm that this is the route to go for someone new to programming (aside from html, but I dont think that counts hehe). Just double checking for myself because i remember seeing in a C++ tutorial that C "poisons" your mind for C++.

    Also, if C is necissary, whats a good book to start with? Thanks!
  2. #2
  3. *bounce*
    Devshed Novice (500 - 999 posts)

    Join Date
    Jan 2002
    Location
    Delft, The Netherlands
    Posts
    514
    Rep Power
    42
    Just double checking for myself because i remember seeing in a C++ tutorial that C "poisons" your mind for C++.
    Personally, I'd say it's the other way around. To a certain degree, C++ is a superset of C, meaning that most C code is also valid C++ code. So syntactically they can appear to be very similar. C++ is the more complicated of the two languages though, as opposed to C which is a fairly "simple", more minimalistic language.

    However, since every programming language is based on certain philosophies, ideas and a certain design, each language comes with its own "mind-set", so to speak. To program C effectively, you need to approach both the language and the problems in a certain way.

    C is more like a thin layer on top of assembly; it's a rather low-level, strictly procedural language.

    C++ on the other hand incorporates object oriented programming, introducing abstract concepts such as classes, objects and templates. Also, C++ does some of its magic at run-time instead of compile-time.

    So, given a problem of at least some complexity, an implementation in C would look quite different from a C++ implementation.

    My point is that C and C++ are actually two quite distinctive languages, once you've mastered them. And since C is the more minimalistic of the two, I think it'd be more suited as a first programming language than C++. If you insist on learning object oriented programming right away, you might consider Java, which is a very clean language.

    Regarding books on C, I recommend the following:

    The C Programming Language, by Kernighan and Ritchie, with Ritchie being the "inventor" of the language. This is a classic, and considered the C bible by many. Some find it hard to read, or have trouble with the exercises, but it is very thorough. It's commonly refered to as K&R.

    Expert C Programming, by Peter van der Linden. Once you feel comfortable using C, and think you know pretty much everything, give this a read. Not only are pointers and arrays explained in excruciating detail, but the author also has a great sense of humour :)

    C: A Reference Manual, by Harbison & Steele. This is the C reference manual for nitpickers. It even covers trigraphs (of all things) in-depth. Covers the standards, and, unlike most reference manuals, has exercises.

    I can't recommend any other introductory books, since I haven't read any of them except for K&R. But I'm sure someone else knows one or two :)
    "A poor programmer is he who blames his tools."
    http://analyser.oli.tudelft.nl/
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2002
    Location
    Huntington Beach, CA
    Posts
    0
    Rep Power
    0
    Ok, thanks so much for the reply!!! I will be going with the K&R book. At www.barnesandnoble.com it got an average rating of 4.5/5 and its only 40$, which from what I have seen is a decent price :). And a follow up question: would Visual C++ 6.0 be good to compile C programs? Thanks again!
  6. #4
  7. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2002
    Location
    London
    Posts
    349
    Rep Power
    12
    IMHO I wouldn't bother learning C before C++ unless you wanted to start working with legacy C systems?

    Go straight ahead with C++, get a book, "The C++ programming language - Bjarne Stroustrup" the guy who wrote C++ its an invaluable resource.. Also get any books you can (esp Effective C++, and More effective C++) by Scott Meyers, who is a superb C++ writer!

    Oh and yes VC++ 6.0 will be fine to compile C programs, but a little bit of overkill to be honest ;)
  8. #5
  9. No Profile Picture
    Not there when you need me
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Oct 2001
    Location
    Berlin, Germany
    Posts
    1,430
    Rep Power
    14
    Originally posted by o0OBruceLeeO0o
    would Visual C++ 6.0 be good to compile C programs?
    It's rather too much. You can of course use it, but you won't need most of the features. And it's (too) expensive.

    My suggestion is, if you're a Wintendo type, that you get Cygwin, read the DOS-Win-to-Linux-HOWTO (chapters 2, 3, 10, 11.4, 11.6, 11.7, 11.8, 11.9, the rest is worth reading too but less important since you haven't actually started using Linux) and use Cygwin (especially, gcc) for your C exercises. If you use Linux, BSD or UNIX anyway, go on using it since you've probably already got a C compiler there. (If you're using Wintendo but are willing to invest a bit more time and HD space, get a Linux distro.)

    The advantage of programming in a UNIX-like environment is that a) it's cheap, b) you get a better feeling for the language (C was used on UNIX before Wintendo was born), c) the K&R book is (afaik - I've never read it) rather UNIX-centric (although everything will also work in VC++, since it's ANSI C) and d) Wintendo is for lusers ;)
  10. #6
  11. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2002
    Location
    Huntington Beach, CA
    Posts
    0
    Rep Power
    0
    Well I got visual studio 6 for 40$ on student discount, so I think ill use it. That way when I start doing C++ I will be more familiar with the IDE. Thanks so much for the replies!
  12. #7
  13. Shes dancing (obviously)
    Devshed Novice (500 - 999 posts)

    Join Date
    Jul 2002
    Location
    the far side
    Posts
    527
    Rep Power
    13
    it can be annoying to see c code used in a c++ program instead of the C++ counter parts, learn c++ first to avoid this, then stepping to c is easy if u good at c++

    microsofts butterfly is their way off telling u their systems have a **** load of buggs
    Advocating Linux Guide
    Lesbian Linux
    Great & Practical Computer Books

    like the links?
  14. #8
  15. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2002
    Posts
    0
    Rep Power
    0
    Why buying a book when you can get one for free. An excelent C++ book (actually two books: Volume 1 is basics, Volume 2 is advanced) from Bruce Eckel, Thinking in C++, can be downloaded from here: http://www.mindview.net/Books/TICPP/...ngInCPP2e.html

    By the way, I agree that learning C before C++ is a good idea (it is like learning to walk before you lear to run), and I fully recommend K&R book.
  16. #9
  17. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2002
    Location
    Huntington Beach, CA
    Posts
    0
    Rep Power
    0
    I ordered the K & R book. Thanks for the replies everyone. Correct me if I am wrong, but now that I think about it, I believe it was the Bruce Eckel, "Thinking in C++" that said C ruins your mind for C++.
  18. #10
  19. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2002
    Location
    Redding
    Posts
    49
    Rep Power
    12

    But, my mind is already ruined.


    How could having experience is such a similar language ruin your brain for C++? It seems to be all about object orientation in C++, where C is strictly procedureal. Please correct me if I'm wrong, but aren't they about 90% the same?
  20. #11
  21. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2002
    Location
    Huntington Beach, CA
    Posts
    0
    Rep Power
    0

    Re: But, my mind is already ruined.


    Originally posted by Rdesign
    How could having experience is such a similar language ruin your brain for C++? It seems to be all about object orientation in C++, where C is strictly procedureal. Please correct me if I'm wrong, but aren't they about 90% the same?
    dont ask me :). Ask Bruce Eckel, or read the first few chapters of his eBook lol.
  22. #12
  23. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2002
    Posts
    0
    Rep Power
    0
    Every approach is a meter of taste and personal preferences. C is indeed procedural language, very close to the machine architecture, whose base has not changed in the last 40 years. By learning it one gets closer to the machine, which I found positive (it is like a car driver that is also a bit mechaniker). While C++ is also "quite low" it forces you to concentrate on more complex things (overloading, inheritance, virtual functions, etc.) One notable example is pointers. In C++ they could be substituted (in many cases) with references, in C they are one of the strongest expressions and keep you thinking on the memory level.

    My advice would therefore be the following. If you have enough time and want a kind of academic approach, learn C before C++. If, however, you want to be productive as fast as possible (though this could be dangerous) go straight to C++.
  24. #13
  25. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2002
    Location
    UK
    Posts
    2
    Rep Power
    0
    Lots of conflicting replies :-) Just to add to them, I'd suggest not learning C before C++. In my experience it takes a long time to get out of the 'bad habits' (in C++; perfectly acceptible in C).

    As for book recommendations, I'd suggest "Accelerated C++" by Koenig and Moo.
  26. #14
  27. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2002
    Location
    Blacksburg VA/Philly PA
    Posts
    38
    Rep Power
    12
    i'd say learn c first. your knowledge in c will be valuable in learning c++. c is still very commonly used in OS development.
  28. #15
  29. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2002
    Posts
    0
    Rep Power
    0
    would Visual C++ 6.0 be good to compile C programs? Thanks again!
    I am using VC++ for 2-3 years working with C++. When I had to compile programs that my students had to write in C the result was broken nerves. C++ is in many ways a superset of C but is stricter. And this makes the difference in projects that C should be used (writing a driver). Therefore, if somebody is serious about learning anu using C should use a C compiler. KDevelop for example has different project settings for C projects. I would sugges cygwin along with an editor you like. Well that's my two pennies.
Page 1 of 2 12 Last
  • Jump to page:

IMN logo majestic logo threadwatch logo seochat tools logo