Thread: Difference between C and C++

  1. #1
    Registered User
    Join Date
    Mar 2011
    Posts
    21

    Difference between C and C++

    An interesting question I ask myself is how exactly do we define the difference between basic C programming and C++? A common distinction seems to be C uses printf and scanf while C++ uses iostream with cout and cin. Another is that C is structured and more about file handling etc. but could still use, namespaces, iostream, cout and cin. Considering C++ was originally 'C with classes' that gives some clue to where the distinction should lie, with more emphasis on classes, parameter passing, header files, and :: (...) and other nicities strewn all over the coding.

    I suppose it hardly matters in the end but do people think the distinction should be made, and sometimes you consciously use one or the other?

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Shouldn't you just go read one of a thousand threads on the topic instead of starting another language war here?


    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    Registered User
    Join Date
    Mar 2011
    Posts
    21
    Excellent reply quzah. You obviously know your stuff. A newbie knows the previous discussions inside out and doesn't need to ask anything.

    Any serious and more helpful replies most welcomed.

  4. #4
    Registered User
    Join Date
    May 2010
    Location
    Naypyidaw
    Posts
    1,314
    Not this again.
    Just take these two as 2 different languages.
    And both C and C++ programmers will be happy.

  5. #5
    Registered User
    Join Date
    Mar 2011
    Posts
    21
    My reply was a little tongue in cheek but actually I find it quite rude to be told it has been discussed before. I was even looking for the report button. I can't possibly sift through the whole forum and see what has been done to death.

    It seems a common fault among programmers - forgetting you were once a newbie as well, both in programming and message boards you join, and how disconcerting it is to be fobbed off before you even start. Some should read a manual of a different sort.

  6. #6
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Modern C++ is quite different from C.
    Modern C++ relies heavily on abstraction, object orientation, generics and encapsulation. It also takes advantage of RAII, smart pointers and the various containers and algorithms in the standard library.
    Modern C++ is not just another "C with classes," even though C++ could be used for such things.
    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.

  7. #7
    Registered User
    Join Date
    Sep 2007
    Posts
    1,012
    I can't possibly sift through the whole forum and see what has been done to death.
    This attitude, in general, is the reason you get jumped on. It is (or was) common netiquette to do a little digging on your own before asking questions. In this case, however, your question might be slightly more defensible because it's very difficult to search for the terms C and C++; often the ++ is ignored, and/or the search terms are too short.

    It seems a common fault among programmers - forgetting you were once a newbie as well, both in programming and message boards you join, and how disconcerting it is to be fobbed off before you even start. Some should read a manual of a different sort.
    Perhaps some people have that flaw. But others do research themselves before posting a question somewhere, and did the same when they were new. Just because somebody is new doesn't mean he shouldn't have to put in a little effort. Don't forget the old adage, "Lurk before you leap." Some forums may welcome questions that have been answered a million times, or that are answered in the FAQ (hint hint), but others don't. Get to know a forum's general feel before jumping in.

  8. #8
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Quote Originally Posted by musicman View Post
    A newbie knows the previous discussions inside out and doesn't need to ask anything.
    So you are saying you actually went and read the previous discussions?

    No, I thought not.

    All these threads turn into is holy wars about which language is better. If you had actually searched on your own, you'd already have your answer. The problem is you are just too lazy to actually search. Two seconds and google would have thousands of these threads for you to learn all you want to know. (http://giyf.com)


    Quzah.
    Last edited by quzah; 06-09-2011 at 04:16 PM.
    Hope is the first step on the road to disappointment.

  9. #9
    Ultraviolence Connoisseur
    Join Date
    Mar 2004
    Posts
    555
    Quote Originally Posted by quzah View Post
    Wouldn't this site be so much cooler if it was "google it, you f*%$!"

    also, please can a mod close this thread for godsake?!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. What is the difference between....?
    By matthayzon89 in forum C Programming
    Replies: 11
    Last Post: 03-31-2010, 10:59 PM
  2. Difference between C++ and VC++?
    By #include Jack in forum C++ Programming
    Replies: 55
    Last Post: 03-31-2010, 04:31 PM
  3. Difference between C and C++
    By blackcell in forum C Programming
    Replies: 4
    Last Post: 01-26-2008, 02:42 PM
  4. difference between c# and C
    By qweasd in forum C Programming
    Replies: 2
    Last Post: 12-12-2005, 10:00 AM
  5. What's the difference?
    By -=SoKrA=- in forum C++ Programming
    Replies: 5
    Last Post: 12-30-2002, 03:23 PM