Thread: To start with C or C++

  1. #1
    Registered User
    Join Date
    Jan 2006
    Posts
    3

    To start with C or C++

    I know another one of these topics but just hear me out. I am new to programming and I am going to learn both of these languages eventually (and others) but which one should I begin with. I was of course going to just start with C like any person would think but after reading around the forums it appears if you start and get more fluent with programming in C due to restrictions it has when you make the switch to C++ you have bad habbits from prgramming in C. I have been looking through threads all day and I just keep coming up with no answers and more questions. Also have read that is easier to learn C if you know C++ then if you know C first and then switching to C++. Maybe I am just rambling I don't know but any input about which would be a better to learn first would be greatly appreciated. So which should I learn first C++ or C, or does it even matter. I just dont want to break into bad programming habbits.

    (No flames please, I know these threads get annoying but believe me I went through many threads and all the different posts just gave me more questions than answers)

  2. #2
    Supermassive black hole cboard_member's Avatar
    Join Date
    Jul 2005
    Posts
    1,709
    If you google "bjarne stroustrups homepage" and go to his faq / tech. faq I'm sure there's some info on why you should learn C++, not C then C++ like many tend to do.

    I guess it also depends on which one you'll be using more (if you know).
    Good class architecture is not like a Swiss Army Knife; it should be more like a well balanced throwing knife.

    - Mike McShaffry

  3. #3
    Rabble Rouser Slacker's Avatar
    Join Date
    Dec 2005
    Posts
    116
    >when you make the switch to C++ you have bad habbits from prgramming in C
    And vice versa. C and C++ idioms are different enough that you'll have issues no matter which you start with. Just pick the language that you feel more comfortable with. Everyone's different, so you can't reasonably expect someone else to make this decision for you.

  4. #4
    Registered User
    Join Date
    Jan 2006
    Location
    Berkeley, Ca
    Posts
    195
    I wouldn't start with either. I would personally start with something like Lisp or any other kind of language that is meant to be "taught in school". I don't know about C++, but C tends to blur a lot of computer science concepts. I think is sort of due to that fact it was designed to be a general purpose programming language. Added to the headache is the fact C requires the user to do the memory management. BTW, both UC-Berkeley and MIT teach Lisp (before C or Java) as a first programming language in the introductory engineering classes

    Just my 2 cents.

  5. #5
    Sr. Software Engineer filker0's Avatar
    Join Date
    Sep 2005
    Location
    West Virginia
    Posts
    235
    I won't go as far as to recommend that you learn Lisp, Pascal, Fortran, Basic, Logo, or any other language that is taught by some schools in their introductory programming classes. Learning to program is different than learning a specific programming language. Once you know how to program, which involves thinking about problem solving in ways that lend themselves to expression as computer programs that correctly solve the problem at hand, you can quickly learn almost any programming language. I will admit that Lisp and Perl (and Scheme, Snobol, APL, and some others) use a programming syntax and model that is quite different, and may give you a deeper understanding of what's really going on when you switch to a procedural language like C or C++, but it it doesn't change my assertion that what you need to do is to learn to program. Pick a language, any language.

    C and C++ differ in some subtle, and some not-so-subtle ways, and while it's true that learning one before the other may limit your initial forays into the other, this awkwardness should pass very quickly as you gain experience in the new language.

    C and C++ can be used to solve the same problems. C++ cannot be used in some environments where C can, but that's because the environments lack the support required, not because the problems themselves cannot be solved in C++. In some environments, C is hard to use and C++ is the best choice because the APIs are all C++ oriented. It is possible (and not difficult) do write code in C that implements an object oriented design. It was being done for years before C++ came on to the scene, and continues to be done. Non-object oriented designs can be easily implemented in C++. It is a wash.

    Object oriented and non-object oriented design are different ways of thinking. It is easier to express an object oriented design in C++ than in C because you don't have to know (or care) about how stuff is working under the hood. I personally believe that it's better to know what's going on under the hood, but that's me.

    If you want to learn the Object Oriented way of thinking, C++ may be the better choice as a first language. If you want to be able to do Linux kernel hacking, C is the way to go. Even if you choose C++, you'll have to learn a lot of C to understand why some things work the way they do in C++ (pointers, arrays, pointer arithmetic), and to deal with operating system calls and such.

    I did learn C long before I learned C++, but I learned Fortran, Lisp, Basic (several dialects), TPL, PDP-11, 8080 and 6502 assembler, Bliss, Algol, Algol68, BCPL, APL, and PL/1 (along with a few others on the side) before I learned C. C++ came along many years later.
    Insert obnoxious but pithy remark here

  6. #6
    Registered User
    Join Date
    Jan 2006
    Posts
    3
    Thanks for the info guys, helped me out a good bit. If anybody else has there own input they can add I would enjoy reading different members opinions.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Data Structure Eror
    By prominababy in forum C Programming
    Replies: 3
    Last Post: 01-06-2009, 09:35 AM
  2. Adventures in labyrinth generation.
    By guesst in forum Game Programming
    Replies: 8
    Last Post: 10-12-2008, 01:30 PM
  3. C++ gui for windows where to start
    By prixone in forum Windows Programming
    Replies: 2
    Last Post: 12-16-2006, 11:48 PM
  4. GNOME Desktop won't start (Mandriva)
    By psychopath in forum Tech Board
    Replies: 10
    Last Post: 07-19-2006, 01:21 PM
  5. Start bar color in WinXP
    By confuted in forum Tech Board
    Replies: 4
    Last Post: 05-03-2003, 06:18 AM