If I Know C++ will it take much to learn C

This is a discussion on If I Know C++ will it take much to learn C within the C++ Programming forums, part of the General Programming Boards category; Aside from the syntax of C and the OOP nature of C++, How much is there to learn of C ...

  1. #1
    Ethernal Noob
    Join Date
    Nov 2001
    Posts
    1,901

    If I Know C++ will it take much to learn C

    Aside from the syntax of C and the OOP nature of C++, How much is there to learn of C if you have a solid base of C++. Is there much incentive to learn C at all if you're learning C++?

  2. #2
    ... kermit's Avatar
    Join Date
    Jan 2003
    Posts
    1,528
    Depends on what you want to do. If you think C would be useful to you in your career (or even if you just want to learn it for personal interest) then by all means learn it. It has been suggested by a few experienced programmers that it is useful to continue learning new programming languages. For example, if you wanted to do some kernel hacking, or even just some system programming, for one of the UNIX variants, you would want to have a really good grasp on C. So in that sense, there is some incentive to learn the language.

    C is not a large language, as far as syntax. You already know how the operators and the keywords work. You do lose a lot of the nice stuff from C++, e.g., with C its a little more work to resize a vector, and work with strings etc. Having learned C++ first, you may have a deficiency in understanding the underlying work done by the string functions. Of course this lack of knowledge is by no means a problem, provided that you recognise it is helpful to learn some of what is going on with the functions you are using. Now some might argue that it's unnecessary to know what is underlying the functions you are using (after all that is one reason why we encapsulate code into a function, in order to not have to worry about what goes on inside) but I still think it is useful in order to avoid some of the 'gotchas' of the C language.

    Allocating memory is another thing that is not so easy in C as in C++. Again, this is not a problem, but you do have to take the time to learn it.

  3. #3
    l2u
    l2u is offline
    Registered User
    Join Date
    May 2006
    Posts
    630
    Why would it be smart to go for C?

  4. #4
    Ethernal Noob
    Join Date
    Nov 2001
    Posts
    1,901
    Well I understand data structures so a lot of that was already covered and I have references if I need more.

    And I haven't learned much of memory allocation (aside from some simple C++ Allocator library functions to mimic a vector using raw memory).

  5. #5
    Registered User
    Join Date
    Jan 2005
    Posts
    7,317
    If you feel comfortable with your current level of C++ knowledge, there are several ways you can go to continue learning. Which one is best depends on your own interests and goals.

    You might consider delving deeper into C++. There are advanced topics that can be interesting and challenging and make you a better programmer.

    You can also try using your current C++ abilities to expand your software design knowledge. For example, you can learn how to identify and implement design patterns.

    Another option is to learn C. You already know almost all C syntax, so you can focus on C idioms and practices, and learning how to write good C code. You will also learn many lower-level details glossed over by C++ constructs.

    Those are just a few options. IMO any would be excellent choices.

  6. #6
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398
    Why would it be smart to go for C?
    If you just want to write programs for the PC, then C++ (plus the WinAPI library) is fine. There are plenty of good C++ compilers for the PC, and if you ever really need to include C code in your C++ program, you (generally) can.

    At my work, all of our embedded systems and drivers are programmed in C. The compilers we have happen to be C, and I think it's easier to control the relationship between the hardware/memory and the software... less abstraction... But, I'm not sure if that's really true... I'm the hardware guy.

    If you are planning to be a professional programmer, you need to understand more than one programming paradigm, and you need to know more than one language. (You need to know how to program without using OOP.) If you already know one procedural language and C++, yoiu could pick-up very C easily.

  7. #7
    Its hard... But im here swgh's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,475
    The vast majority of C students I know of have gone on to learn C++. Not many of them have stuck with C as a main language to use. These few people went on to design lunix systems and deeper OS programming structure. C has many uses, and as a whole is a well leveraged study along side C++.

    EDIT These people I "know" are past college buddies. Meh, they think I was the odd one out as I went on to favor C++ over C. But my main goal is to program game software, so I had no choice.
    I'm just trying to be a better person - My Name Is Earl

  8. #8
    Registered User
    Join Date
    Aug 2005
    Posts
    194
    I've been told that, "You don't know C++ in you don't know C." I'm not sure I endorse that view, but I have been told that.

  9. #9
    Registered User
    Join Date
    Jan 2005
    Posts
    7,317
    You probably don't know all of C++ if you don't know C, but you probably don't know all of C++ even if you do know C, so that statement is pretty irrelevent. I'm guessing the point is that the person who told you believes that knowledge of the C parts of C++ are essential to a good understanding of the C++ language. I'm not sure I'd agree with that, though.

  10. #10
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,892
    I agree with it: the C parts of C++, as in functions, if-statements, and in fact pretty much all the low-level syntax are quite essential to C++

    Beyond that, no.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  11. #11
    Registered User
    Join Date
    Apr 2006
    Posts
    20
    Until now POSIX threads are not compatible with C++. So if you want to write cross platform multithreaded software, you better stick to C, at least for now.

  12. #12
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,383
    Excuse me!?

    Even if it that was case, there wouldn't be no problem in taking a C library into your C++ code, or better yet, wrap it in C++ classes.
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  13. #13
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,892
    As has been done with Boost.Threads.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. What do I learn now?
    By Lorgon Jortle in forum C++ Programming
    Replies: 14
    Last Post: 03-14-2009, 06:44 PM
  2. Looking to learn C++
    By Fuzzy91 in forum C++ Programming
    Replies: 40
    Last Post: 04-13-2006, 02:38 AM
  3. You have to learn C in order to learn C++
    By gandalf_bar in forum A Brief History of Cprogramming.com
    Replies: 20
    Last Post: 07-16-2004, 10:33 AM
  4. Novice trying to learn C++
    By dead in forum C++ Programming
    Replies: 10
    Last Post: 12-01-2003, 08:25 PM
  5. Trying to learn guitar
    By Ben_Robotics in forum A Brief History of Cprogramming.com
    Replies: 12
    Last Post: 07-10-2003, 03:15 AM

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