C vs C++

This is a discussion on C vs C++ within the C Programming forums, part of the General Programming Boards category; I've learned variations of Basic for many years and C is my first exposure to this type of language. I ...

  1. #1
    Registered User
    Join Date
    May 2005
    Posts
    207

    C vs C++

    I've learned variations of Basic for many years and C is my first exposure to this type of language.

    I was wanting to learn C exclusively, but there seems to be some cool stuff in C++ also.

    Can I use these tutorials to learn C? How do I differentiate them? Eventually I need to learn C++ but right now I don't need the extra information. I'm happy with C89.

    I did a search on this forum for C++ and didn't find anything so I assumed there was no related question...

    mw
    Last edited by Lionmane; 06-06-2005 at 11:29 PM.

  2. #2
    Sweet
    Join Date
    Aug 2002
    Location
    Tucson, Arizona
    Posts
    1,812
    Well pretty much anything you can do in C you can do in C++(There are exceptions, I don't remeber them).
    You *can* learn C from the tutorials here but I wouldn't. Search for some C tutorials on google or get a book.
    Woop?

  3. #3
    Registered User
    Join Date
    May 2005
    Posts
    207
    That was not very helpful. Is there some sort of reference that I can use that will help me to differentiate them?

    mw

  4. #4
    ---
    Join Date
    May 2004
    Posts
    1,379
    C++ is OO. C is procedural.

  5. #5
    lyx
    lyx is offline
    Amateur
    Join Date
    Sep 2003
    Posts
    228
    > That was not very helpful. Is there some sort of reference that I can use that will help me to differentiate them?
    If you really want a reference, there's the standard but it's not free; there are also the drafts. Anyway, it's quite hard to read sometimes.
    Aside from that, the best you can do is learn with a C course so you don't write C++ without knowing.
    If you'd like to learn a "pure" C dialect for a start, put your compiler in a C mode with something like -std=c89 and add -Wall -pedantic for GCC to see all warnings. (If you are compiling C source files, the compiler won't accept C++ anyway)

    > Eventually I need to learn C++
    Well, you need not, you should. Yet, if you don't feel like coding in C++, you can do much in C (perhaps not everything C++ does but there is always other ways) with some more efforts but if you like C better, you will try eventually.

  6. #6
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    >C++ is OO. C is procedural.
    C++ is not OO, it's multi-paradigm (shameless use of a buzzword, I know). It just happens that OO is one of those paradigms and most people aren't well informed enough to realize that there's more to C++ than classes and inheritance.

    >so I assumed there was no related question...
    Your question pops up regularly. C and C++ are completely different languages that happen to base some features off of one another. If you're happy with C and don't think you'll need C++, don't bother. If you expect to need C++ at any point in the future, go for it. You seem to be under the assumption that it's not possible to learn and use two languages simultaneously.
    My best code is written with the delete key.

  7. #7
    Jez
    Jez is offline
    The C-er
    Join Date
    Mar 2004
    Posts
    192
    If your familiar with programming concepts from BASIC then you shouldn't have too much trouble with C, although it's perhaps not as user friendly as BASIC. Make sure you get a copy of "The C Programming Language" by Kernighan + Ritchie (The creators of the C language). Your local library will almost certainly have a copy. This is close to a reference, (it has a reference section at the back) and introduces a lot of core concepts. Another good book is "C - a reference manual" by Harbison /Steele. This covers C99 as well but is heavy going in places, although pretty definitive.

  8. #8
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    If you are going to learn C++ then learn C++ and dont bother with C. It is 500% easier to learn C already knowing C++ than it is to go the other way around.
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  9. #9
    Has a Masters in B.S.
    Join Date
    Aug 2001
    Posts
    2,267
    >
    If you are going to learn C++ then learn C++ and dont bother with C. It is 500% easier to learn C already knowing C++ than it is to go the other way around.
    <

    i STRONGLY disagree with this assesment... its easier to learn C then expand to the much more "open" rules of C++, than it is to jump from C++ into the strictness and numerous language differences between that and C89 or C99. you run into the same problem on a much smaller level going from C99 to C++...
    and plus you will probably be more likely to write better code...

    >
    Can I use these tutorials to learn C? How do I differentiate them? Eventually I need to learn C++ but right now I don't need the extra information. I'm happy with C89.
    <

    if you stay with C learn C99, but its always nice to know C++
    Last edited by no-one; 06-07-2005 at 12:05 PM.
    ADVISORY: This users posts are rated CP-MA, for Mature Audiences only.

  10. #10
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,048
    If you are going to learn C++ then learn C++ and dont bother with C. It is 500% easier to learn C already knowing C++ than it is to go the other way around.
    I suppose you've tried it both ways.

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21