Thread: Starting out...

  1. #1
    Registered User
    Join Date
    Dec 2007
    Location
    SW England
    Posts
    2

    Starting out...

    Is it better to learn C first and then C++ or can I just go straight into C++?

    I've just started with 'C for dummies' and in it, it says that if you learn C you'll end up knowing 95% of C++. Is this true or will I have to relearn everything from scratch?

    Regards,
    Blarney

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Is it better to learn C first and then C++ or can I just go straight into C++?
    If you want to learn C, go straight to learning C.

    If you want to learn C++, go straight to learning C++.

    I've just started with 'C for dummies' and in it, it says that if you learn C you'll end up knowing 95% of C++. Is this true or will I have to relearn everything from scratch?
    It's probably false, or at least an exaggeration. It's hard to measure "95% of C++" anyway.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User ssharish2005's Avatar
    Join Date
    Sep 2005
    Location
    Cambridge, UK
    Posts
    1,732
    I've just started with 'C for dummies' and in it, it says that if you learn C you'll end up knowing 95% of C++. Is this true or will I have to relearn everything from scratch?
    And perhaps C for dummies is most a best choice of books which I ave come across. Have a look at this thread. You will find good suggestions on which book need to refereed. http://cboard.cprogramming.com/showthread.php?t=74079

  4. #4
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    There are MANY things that are exactly the same in C and C++ - so if you know C first, then you don't have to learn those basic parts of C++ that are identical to C.

    There is one main difference in C++ - you are supposed to use object oriented design in C++ - it is perfectly possible to produce C++ code that doesn't, just like you can use a Land Rover (serious off-road vehicle) to drive on London streets - but you aren't really using the language as it was designed to be used. [In both examples, there are many that don't use it as it was intended!]

    There are also a bunch of tiny differences - there are new reserved words, so some names that are OK to use in C are now used by the language itself as keywords, so you won't be able to use those names for your own names, such as "operator", "new", "delete", "template", and several more. C++ is more strict about types, so some code that works fine in C will give compiler errors in C++.

    There is also a large set of "Standard Template Library" functionality that gives powerful functionality to the C++ application programmer. To understand and use these libraries is part of learning C++.

    Also, bear in mind that if you are learning to program as well as learning C or C++, you will be learning two skills:
    - Programming as such generally how to make a program do what you want, which consists problem solving, splitting a problem into smaller portins, debugging, and many other skills.

    - The syntax, functions and behaviour of the C or C++ language.

    The far more complex part of that is to learn how to program. The language may seem daunting, with strict rules about how and where you can put what, you have to put semicolons in certain places, shouldn't have them in other places, etc, etc. But that is still a lot shorter/simpler process than becomming a skilled software developer.

    In summary, you have a lot to learn whichever way you do it, and you will have to work at it - don't believe for an instant that the books called "learn C++ in 21 days" actually mean that you are a quality programmer after 21 days [assuming you even manage to get through the examples in the book in that time].

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  5. #5
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    I think the reverse is a little more to the truth - know C++ and you know 90/95% of C.
    But they are different languages with different ways of making your code. Ie, in C+, we use object oriented approach, but we can't do that in C.
    Two different languages, so like each other. so with as much as anything else, learn one, stick with one.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  6. #6
    Registered User
    Join Date
    Dec 2007
    Location
    SW England
    Posts
    2
    Thanks for all your replies. The task ahead of me seems daunting, especially since my only previous experience with programming was BBC BASIC many, many years ago

    But I'll continue in my quest to at least understand programming on a higher level.

    As an aside, bearing in mind the platform that I'm using ie. Linux. Is there another language that I could get quicker results creating simple client-server apps in a windows environment (Kde). I basically want to understand networking ie. TCP/IP.

    Regards,
    Blarney

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Starting programs
    By Molokai in forum C Programming
    Replies: 1
    Last Post: 04-16-2009, 10:10 AM
  2. Replies: 9
    Last Post: 03-20-2009, 05:22 PM
  3. Interpreter.c
    By moussa in forum C Programming
    Replies: 4
    Last Post: 05-28-2008, 05:59 PM
  4. i am not able to figure ot the starting point of this
    By youngashish in forum C++ Programming
    Replies: 7
    Last Post: 10-07-2004, 02:41 AM
  5. question about reading inputs starting with 0
    By jibbles in forum C Programming
    Replies: 8
    Last Post: 08-09-2004, 03:27 AM