View Poll Results: Which should I learn and why?

Voters
34. You may not vote on this poll
  • C

    6 17.65%
  • C++

    28 82.35%

Thread: C++ or C

  1. #1
    Registered User CompiledMonkey's Avatar
    Join Date
    Feb 2002
    Location
    Richmond, VA
    Posts
    438

    C++ or C

    I was planning on learning a little bit of C or C++. What I'm trying to figure out is which I should learn. I already know and use Java everyday, so I have experience in OO programming. I assume most people will say C++, I'm just wondering why. Thanks in advance.

  2. #2

  3. #3
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    Well, since C is a subset of C++, the only *real* difference is the C++ compiler's casting complaints. C++ is just much more flexible and powerful in the sense that it is truly "a programming language for programmers, not just programs". The customization features, however, don't appeal to everyone, and in that case, C is just as good. Some situations might even be more appropriate just using C (I suppose?). I just plain like C++ better. After all, what's life without a constructor?
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

  4. #4
    People Love Me
    Join Date
    Jan 2003
    Posts
    412
    Well, look at the names: C, and C++.

    In case you didn't know, that means "increased C".
    Therefore, it's better than C in every way, trust me.
    C++ is much better. Learn C++.

  5. #5
    Registered User CompiledMonkey's Avatar
    Join Date
    Feb 2002
    Location
    Richmond, VA
    Posts
    438
    Originally posted by Sebastiani
    After all, what's life without a constructor?
    LOL! That's a great point really.

  6. #6
    Registered User zahid's Avatar
    Join Date
    Aug 2001
    Posts
    531
    You better try with C++ , only reason you know OOP and C++ is best for that.
    [ Never code before desk work ]
    -------------------------------------:-->
    A man who fears Nothing is the man who Loves Nothing
    If you Love Nothing, what joy is there in your life.
    =------------------------------------------------------= - I may be wrong.

  7. #7
    Registered User CompiledMonkey's Avatar
    Join Date
    Feb 2002
    Location
    Richmond, VA
    Posts
    438
    Any real reason not to learn straight C? I'd be doing this mostly for fun and my own benefit. I don't plan on leaving my Java job anytime soon.

  8. #8
    Programming Sex-God Polymorphic OOP's Avatar
    Join Date
    Nov 2002
    Posts
    1,078
    Because C++ enforces better type-checking making it less likely for someone learning to make a mistake.

  9. #9
    Has a Masters in B.S.
    Join Date
    Aug 2001
    Posts
    2,263
    can you people give an non text book answer to his question?

    C and C++ are a hell of a lot more different than most people believe, or even realize.

    >I assume most people will say C++, I'm just wondering why.

    because you already know OOP, and you probably won't take easy to C because of it.

    >Therefore, it's better than C in every way, trust me.

    that is purely opinion.

    >Well, since C is a subset of C++

    technically you have that backwards.
    Last edited by no-one; 01-26-2003 at 12:42 AM.
    ADVISORY: This users posts are rated CP-MA, for Mature Audiences only.

  10. #10
    Registered User CompiledMonkey's Avatar
    Join Date
    Feb 2002
    Location
    Richmond, VA
    Posts
    438
    Originally posted by Krak
    Therefore, it's better than C in every way, trust me.
    I disagree with that. If it was so much better, why is the linux kernel written in asm/c? :dunno:

  11. #11
    Programming Sex-God Polymorphic OOP's Avatar
    Join Date
    Nov 2002
    Posts
    1,078
    Originally posted by no-one
    >Well, since C is a subset of C++

    technically you have that backwards.
    No, it's not.

    While it can be arguable to call C a true subset of C++, C++ is in no conceivable way a subset of C.

  12. #12
    Just a Member ammar's Avatar
    Join Date
    Jun 2002
    Posts
    953
    He is right...
    There are tons of threads on that topic, but I think that if you know Java it's better for you to learn C++, because you must know OOP concepts, and ofcourse C++ gives you more capabilities, and it's always up to you to choose what language to learn.
    none...

  13. #13
    Has a Masters in B.S.
    Join Date
    Aug 2001
    Posts
    2,263
    I was just jackin with symantics take a chill pill buddy.

    but if you want to get technical.

    C++ is technically a superset of C, and C is as you say arguably and not truely a subset of C++.

    C is has several superset languages, and not many if any of them can claim C as a subset.

    ::edit::
    then again agueably C++ is not truely a superset either, but it more closely fits or is a superset.
    Last edited by no-one; 01-26-2003 at 01:09 AM.
    ADVISORY: This users posts are rated CP-MA, for Mature Audiences only.

  14. #14
    Registered User codingmaster's Avatar
    Join Date
    Sep 2002
    Posts
    309
    C++ RuleZzz

    OOP is very cool, I think I couldn't (really) live without it...

    But C++ is C, so I like C too!!!

  15. #15
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,380
    C and C++ are both good languages. Both have their different areas of application, so I don't think the discussion "Is C better than C++" is a very usefull discussion.

    Anyway, I agree with Zahid. You already know Java, so you know OOP. Therefore I'd suggest you learn C++, you will have less problems with learning C++ then learning C.

    But this doesn't imply it is wrong to learn C.

Popular pages Recent additions subscribe to a feed