Thread: starting with C?

  1. #1
    Registered User
    Join Date
    Dec 2007
    Posts
    10

    starting with C?

    Hello Guyz...

    Just started programmng and wanted to know what programming language to start with...C++ came to mind but a friend of mine told me to have an idea of C before moving to C++...

    What do you guyz think....

    Also on an editor...I have hear of the Emac application for programmers but I found this application which I think it's a okay at least for a start..http://editplus.com/

    Regards,
    'kk'

  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >a friend of mine told me to have an idea of C before moving to C++...
    Unnecessary. If you want to learn is C++, don't waste your time learning another language first.

    >I have hear of the Emac application for programmers
    You'll hear about emacs and vi. Both are typically for elitist masochists, especially if you're using Windows. An IDE would probably get you started the quickest. Code::Blocks is good, as is Visual C++ 2005 or 2008 Express.
    My best code is written with the delete key.

  3. #3
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,210
    If your goal is to learn C++, learn C++. If you want to learn C, then learn C.

    Bit of a history:

    C started out in the 70's from a language called B, which came from a language called BCPL. Eventually, in the 80's, there was a desire to extend C to natively support the Object Orriented Programming paradigm. The ability to do this was added, and I believe the original version was called C With Classes. Eventually, though, this new version of C underwent some language rule changes, which made it not entirely compatible with C. It ended up becoming its own language, while still trying to retain a lot of C's roots. This new language became C++.

    In some ways C++ easily beats out C. There are safer ways to do things. You have to know less about the hardware details and how everything works at the machine level. That's not to say that you don't have to know these things, but C++ removes you further from the machine level and makes things much safer.

    On the other hand, I really like C. It's basic, and requires you to be completely specific. It's easy to learn if you're motivated... I mean really motivated. It's hard to get really good at it, though. It takes a lot of time to learn it properly, but imo, you become a better programmer for it.

    Now arguments to learn C first:

    • If you get stuck and have to write something in C++, you can revert to C-style code for the most part. You can't go the other way and write C++ code in C as easily.
    • You have a better understanding of why C++ allows things (that came from C), but at the same time you are discouraged from using.
    • You can understand exactly how the special C++ features are actually implemented at the low level.


    Arguments to learn C++ first:

    • You can learn safer ways of writing code without resorting to relatively unsafe C approaches.
    • You can get used to use OOP and template programming as natively supported by the language instead of having to implement it in a roundabout manner in C.
    • You will probably not resort to C code when faced with a challenge.


    I'm sure others will pick apart these lists and alter them as they wish. They are not important arguments unless you specifically want to learn both languages.

    As far as editors, I like JEdit, but I'm a very weird individual. Pick whatever you want. Although Prelude suggests you use an IDE, which could be very helpful, I would suggest you eventually learn how to compile from the command line (even if you never do this in practice most of the time).

  4. #4
    Registered User
    Join Date
    Dec 2007
    Location
    Lisbon, Portugal
    Posts
    19
    I had Ubuntu 7.10 ( It's a Linux Thingie) Installed here, pureply for programming, and I use the text editor that comes with it, it's Gedit.

    It's really good, gives you neat stuff like, quick identation, line number display, and diferent colours for different types of code.

    About learing C or C++, if I had a choice, I would go C++, but the college wanted me to go C, so, here I am.

  5. #5
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    But I think that college wants you to do the wrong thing. I think, if you can, you should make up your own mind on which language is the best for you, C or C++.
    Myself, I only see C++, since C is still pretty much a subset of C++ and can be reverted to, if necessary (the reverse is, of course, not possible).
    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.

  6. #6
    Registered User
    Join Date
    Dec 2007
    Location
    Germany
    Posts
    2
    Quote Originally Posted by Elysia View Post
    ...since C is still pretty much a subset of C++ and can be reverted to...
    Not at all. There are many well-working C codes that won't compile in C++.
    --> http://david.tribble.com/text/cdiffs.htm

  7. #7
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    No, not out of the bat, but with a few modifications, it compiles fine. And few C compilers are really strict adhering to the standard, though C++ compilers are, so that's another slight problem, but aside from that, it's all dandy.
    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.

  8. #8
    Registered User
    Join Date
    Dec 2007
    Location
    Germany
    Posts
    2
    Quote Originally Posted by Elysia View Post
    No, not out of the bat, but with a few modifications, it compiles fine. And few C compilers are really strict adhering to the standard, though C++ compilers are...
    C and C++ have different standards. From casting the return value of malloc (C++ needs that, in C it should be avoided) to nasty things like 'sizeof('a')' which gives different values in C and C++. Once upon a time C was a subset of C++, but today there are many contrasts. If someone must include C code into a C++ project, it's better to use a real C compiler and let the linker put it all together.

  9. #9
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    They are different standards, but C is still pretty much a subset of C++, since it has inherited a lot from C and still contains pitfalls from C.
    Care should be taken, but if you know C++, you pretty much know C. Assuming you've at least handled raw pointers and such and not relied on the STL for everything. But I would still rather that someone writes safer code using the STL than use the more error-prone C.
    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.

  10. #10
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,318
    Just go straight for C++. You'll likely avoid becoming yet another C-with-classes programmer that thinks they know C++.

    Emacs is a pet-peeve of mine. Ugly as hell and very non-intuitive to the casual user. Whoever thought up multi-part keyboard shortcuts should be shot. And now they've even got them in MSVC, oh the horror!!!
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

  11. #11
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    C is mostly for drivers or embedded systems that don't support C++. If you want to build a large application on something like Windows or UNIX it would be crazy to do it all in C (just like it would be crazy to do it all in Assembly). So I'd say learn C++.
    Although, if you start out learning C++, you can't avoid learning the basics of C at the same time, because C++ is a superset of C (with a few minor differences). So the if, for, do, while, switch... syntax is the same, intrinsic types are the same, functions are the same (but can do more, like overloading...), and all the standard C functions are included as well, although you don't have to use them.

  12. #12
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Also on an editor...I have hear of the Emac application for programmers but I found this application which I think it's a okay at least for a start..http://editplus.com/
    EditPlus looks okay, though it seems designed more for web development than C or C++ programming. Since it is a text editor you would need to learn how to use the compiler separately, presumably at the command line. If this is not your cup of tea, follow one of Prelude's IDE suggestions (both are available at zero price). I have also found Netbeans 6 to be a reasonably good free IDE for C and C++.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  13. #13
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    SciTE is the best for everything

  14. #14
    Registered User
    Join Date
    Dec 2007
    Posts
    10

    thank you

    I want to thank you guyz for all the information you have posted. I did really appreciate it everything.

    The question I am gonna ask now is...how do I know the C++ can write this particular programme I have in mind...

  15. #15
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    how do I know the C++ can write this particular programme I have in mind...
    Start by learning the basics, e.g., by going through Glassborow's You Can Do It! book. If you have any questions, post in the C++ programming board. This board is for C programming, not C++.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Starting programs
    By Molokai in forum C Programming
    Replies: 1
    Last Post: 04-16-2009, 10:10 AM
  2. Interpreter.c
    By moussa in forum C Programming
    Replies: 4
    Last Post: 05-28-2008, 05:59 PM
  3. i am not able to figure ot the starting point of this
    By youngashish in forum C++ Programming
    Replies: 7
    Last Post: 10-07-2004, 02:41 AM
  4. question about reading inputs starting with 0
    By jibbles in forum C Programming
    Replies: 8
    Last Post: 08-09-2004, 03:27 AM
  5. 12 year old starting...
    By Xterria in forum Game Programming
    Replies: 2
    Last Post: 09-24-2001, 07:33 PM