Self-taught C

Discussion in 'C Programming' started by Sleepy Duke, Feb 3, 2012.

  1. Sleepy Duke

    Sleepy Duke Guest

    What are the best methods you all have found for teaching yourselves how to code proficiently in C?
    Sleepy Duke, Feb 3, 2012
    #1
    1. Advertising

  2. On Feb 3, 12:24 pm, Sleepy Duke <> wrote:
    > What are the best methods you all have found for teaching yourselves how to code proficiently in C?


    I'm a teenager who writes in C as a hobby. Obviously my advice
    won't be worth much, but here it is:

    K&R was more in-depth than the web tutorial I first read.
    I also learnt a few things from reading the old Unix sources
    (http://minnie.tuhs.org/cgi-bin/utree.pl). I'm pretty sure writing
    a lot of code helps.
    Bl0ckeduser ., Feb 3, 2012
    #2
    1. Advertising

  3. On Feb 3, 5:24 pm, Sleepy Duke <> wrote:
    > What are the best methods you all have found for teaching yourselves how to code proficiently in C?
    >

    Basically do it.

    If you're sitting in a bedroom on your own, the most likely thing
    you'll want to code is a game. So get graphics working as fast as you
    can. It's harder now than it was to get a simple character-based
    raster that can be used for moving space invaders round the screen.
    But that's usually the best place to start.
    Malcolm McLean, Feb 4, 2012
    #3
  4. On Feb 3, 5:24 pm, Sleepy Duke <> wrote:

    > What are the best methods you all have found for teaching yourselves how to code proficiently in C?


    write lots of code.

    the best way I found was already knowing anothe couple of programming
    languages, but this probably doesn't help...
    Nick Keighley, Feb 5, 2012
    #4
  5. On Feb 3, 7:54 pm, "Bl0ckeduser ." <> wrote:
    > On Feb 3, 12:24 pm, Sleepy Duke <> wrote:



    > > What are the best methods you all have found for teaching
    > > yourselves how to code proficiently in C?

    >
    > I'm a teenager who writes in C as a hobby. Obviously my advice
    > won't be worth much, but here it is:


    if you are a competent C programmer then your advice may well be
    useful. It probably helps that you learned C recently so you have a
    better memory of the process

    > K&R was more in-depth than the web tutorial I first read.


    yes. Most web tutorials are, sadly, crap. K&R is great, though some
    find it a bit heavy going. They don't waste words.

    > I also learnt a few things from reading the old Unix sources
    > (http://minnie.tuhs.org/cgi-bin/utree.pl).



    > I'm pretty sure writing
    > a lot of code helps.


    absolutely. Learn by doing.
    Nick Keighley, Feb 5, 2012
    #5
  6. Sleepy Duke

    gwowen Guest

    On Feb 5, 12:32 pm, Nick Keighley <>
    wrote:
    > On Feb 3, 5:24 pm, Sleepy Duke <> wrote:
    >
    > > What are the best methods you all have found for teaching yourselves how to code proficiently in C?

    >
    > write lots of code.


    That.

    It'll help to have a project or something that you want to accomplish,
    and work htowards that goal.

    Set your compiler to its most picky settings, and understand every
    single diagnostic message it gives you. And them eliminate them,
    figuring out what misunderstanding led to them occuring in the first
    place.

    Then run the code under valgrind or some similar bounds/leak checker
    and understand all its diagnostics too.
    gwowen, Feb 6, 2012
    #6
  7. Sleepy Duke

    Joe Pfeiffer Guest

    gwowen <> writes:

    > On Feb 5, 12:32 pm, Nick Keighley <>
    > wrote:
    >> On Feb 3, 5:24 pm, Sleepy Duke <> wrote:
    >>
    >> > What are the best methods you all have found for teaching yourselves how to code proficiently in C?

    >>
    >> write lots of code.

    >
    > That.
    >
    > It'll help to have a project or something that you want to accomplish,
    > and work htowards that goal.


    I think that's the most important single advice that can be given.

    > Set your compiler to its most picky settings, and understand every
    > single diagnostic message it gives you. And them eliminate them,
    > figuring out what misunderstanding led to them occuring in the first
    > place.
    >
    > Then run the code under valgrind or some similar bounds/leak checker
    > and understand all its diagnostics too.
    Joe Pfeiffer, Feb 7, 2012
    #7
  8. > > It'll help to have a project or something that you want to accomplish,
    > > and work htowards that goal.

    >
    > I think that's the most important single advice that can be given.


    Agreed. But working at a support role where you have to read lots of code
    and fix it is even better than that and along with it, you'll have it all.
    Fritz Wuehler, Feb 7, 2012
    #8
  9. On Feb 7, 9:26 am, Fritz Wuehler
    <> wrote:
    > > > It'll help to have a project or something that you want to accomplish,
    > > > and work htowards that goal.

    >
    > > I think that's the most important single advice that can be given.

    >
    > Agreed. But working at a support role where you have to read lots of code
    > and fix it is even better than that and along with it, you'll have it all..


    dunno, being a maintenance programmer on a nasty pile of code can be a
    dispiriting experience. I wouldn't suggest i was necessarily a good
    way to learn.
    Nick Keighley, Feb 7, 2012
    #9
  10. Sleepy Duke

    James Kuyper Guest

    On 02/03/2012 12:24 PM, Sleepy Duke wrote:
    > What are the best methods you all have found for teaching yourselves how to code proficiently in C?


    1. Study "The C Programming Language" by Kernighan & Ritchie. However,
    I've heard that this is not a good introductory book for someone with no
    previous experience in programming. I wouldn't have noticed if that were
    the case - C was my fourth programming language, after FORTRAN I (sic),
    Basic, and APL.

    2. Write lots of code while trying to achieve very specific goals. If
    you don't have a specific goal you're trying to achieve with the code,
    you won't learn as much while writing it.
    --
    James Kuyper
    James Kuyper, Feb 7, 2012
    #10
  11. Sleepy Duke

    Stefan Ram Guest

    Sleepy Duke <> writes:
    >What are the best methods you all have found for teaching
    >yourselves how to code proficiently in C?


    Reading C books (including the C specification), Reading
    books on software engineering (not C specific), Reading and
    porting code (e.g., C code from other systems to the Amiga
    or from other languages to C), writing C code, talking with
    friends about C, Reading the C source code of a computer
    game while playing it to find the tricks (how to play and
    win), and giving C classes (my next C class starts this
    thursday [the day after tomorrow] in Berlin; it's a real
    C class [not a C++ class]).

    --
    Stefan Ram http://www.purl.org/stefan_ram/
    Programmierkurse http://www.purl.org/stefan_ram/pub/berlin-kurs
    Stefan Ram, Feb 7, 2012
    #11
  12. Sleepy Duke

    notbob Guest

    On 2012-02-03, Sleepy Duke <> wrote:

    > What are the best methods you all have found for teaching yourselves
    > how to code proficiently in C?



    There are good beginning tutorials online. Here's a few:
    http://how-to.linuxcareer.com/c-development-on-linux-introduction
    http://www.cprogramming.com/tutorial/c-tutorial.html
    http://www.codingunit.com/the-history-of-the-c-language

    Chew on these till you milk them dry, then look for some books. Read
    the reviews on Amazon. If you have a B&N or good library, go there
    and read 'em before buying. I once bought a C book that was highly
    recommended and was not happy with it.

    As another poster recommended, learn with a goal in mind. Excellent
    advice. I've dabbled unsuccessfully in coding for yrs and never
    really learned anything cuz I never had a reason. I've recently
    discovered arduino hobby electronics, a hands-on fun end to my means.
    It can be done in C. I think this stuff is a hoot and it got me back
    into learning programming. Some examples:

    http://ardrone.parrot.com/parrot-ar-drone/usa/

    http://www.adafruit.com/products/170

    http://www.adafruit.com/products/332 (watch the belt video)

    http://tinyurl.com/7p886h5

    This is all stuff that can be done with Arduino electronics and C
    coding. I'll never get to the point of those amazing formation flying
    q-copters, but it fires one's imagination and provides inspiration.

    Oh! .....also learn code debugging as you go. Nothing is more
    discouraging than debugging bad code, so learn how early.

    notbob --geezer learning C way too late, but still trying ;)

    --
    Fight internet CENSORSHIP - Fight SOPA-PIPA
    Contact your congressman and/or representative, now!
    http://projects.propublica.org/sopa/
    vi --the heart of evil!
    notbob, Feb 7, 2012
    #12
  13. On 7 Feb 2012 14:29:21 GMT, notbob <> wrote:

    >On 2012-02-03, Sleepy Duke <> wrote:
    >
    >> What are the best methods you all have found for teaching yourselves
    >> how to code proficiently in C?

    >
    >
    >There are good beginning tutorials online. Here's a few:
    >http://how-to.linuxcareer.com/c-development-on-linux-introduction


    This one has some really confusing examples (e.g., the discussion
    regarding the ++ operator).

    The discussion of pointers has major errors such as:

    Next, we dereference ptoi, meaning we say "stop pointing to x and
    start pointing to y".

    and

    when working with arrays, you don't have to use pointers, but it's
    nice to do so, because operations will be faster,

    and

    Another important aspect is that any character array in C ends with
    the null character

    and it gets worse.

    --
    Remove del for email
    Barry Schwarz, Feb 7, 2012
    #13
  14. Sleepy Duke

    notbob Guest

    On 2012-02-07, Barry Schwarz <> wrote:

    > The discussion of pointers has major errors such as:


    That's why I provided several sites. I've taken formal college C
    programming classes twice and have yet to encounter a single learning
    method that isn't flawed, somehow. If not blatant mistakes, then
    outright omissions, like I will somehow absorb the correct approach
    and/or code syntax by magic. One teacher used both C and C++ code as
    if they were the same. Similar experiences with 2 books I've bought.
    I've discovered having several sources for the same info usually
    provides the answer, if only by consensus. ;)

    nb

    --
    Fight internet CENSORSHIP - Fight SOPA-PIPA
    Contact your congressman and/or representative, now!
    http://projects.propublica.org/sopa/
    vi --the heart of evil!
    notbob, Feb 7, 2012
    #14
  15. Sleepy Duke

    Stefan Ram Guest

    notbob <> writes:
    >method that isn't flawed, somehow. If not blatant mistakes, then
    >outright omissions,


    Some omissions are necessary in teaching, mistakes are not.
    Stefan Ram, Feb 7, 2012
    #15
  16. Sleepy Duke

    notbob Guest

    On 2012-02-07, Stefan Ram <-berlin.de> wrote:

    > Some omissions are necessary in teaching, mistakes are not.


    ......and of course, in the interest of "teaching", you are going to
    omit what those "necessary" omissions might be and why.

    Balderdash!

    nb

    --
    Fight internet CENSORSHIP - Fight SOPA-PIPA
    Contact your congressman and/or representative, now!
    http://projects.propublica.org/sopa/
    vi --the heart of evil!
    notbob, Feb 7, 2012
    #16
  17. Sleepy Duke

    Jorgen Grahn Guest

    On Tue, 2012-02-07, Nick Keighley wrote:
    > On Feb 7, 9:26 am, Fritz Wuehler
    > <> wrote:
    >> > > It'll help to have a project or something that you want to accomplish,
    >> > > and work htowards that goal.

    >>
    >> > I think that's the most important single advice that can be given.

    >>
    >> Agreed. But working at a support role where you have to read lots of code
    >> and fix it is even better than that and along with it, you'll have it all.

    >
    > dunno, being a maintenance programmer on a nasty pile of code can be a
    > dispiriting experience. I wouldn't suggest i was necessarily a good
    > way to learn.


    Still, IMO you need to work with (within) bad code to really learn C.
    It teaches you how easy it is to end up in a mess, a few ways to get
    there, and debugging/refactoring techniques.

    And writing your own, fresh code can feel like a luxury afterwards ;-)

    /Jorgen

    --
    // Jorgen Grahn <grahn@ Oo o. . .
    \X/ snipabacken.se> O o .
    Jorgen Grahn, Feb 7, 2012
    #17
  18. Sleepy Duke

    JohnF Guest

    > Fritz Wuehler <> wrote:
    >> Joe Pfeiffer <>
    >> > gwowen <> writes:
    >> >> Nick Keighley <> wrote:
    >> >> > Sleepy Duke <> wrote:
    >> >> >
    >> >> > What are the best methods you all have found for
    >> >> > teaching yourselves how to code proficiently in C?
    >> >>
    >> >> write lots of code.
    >> >
    >> > It'll help to have a project or something that you want
    >> > to accomplish, and work towards that goal.

    >>
    >> I think that's the most important single advice that can be given.

    >
    > Agreed.


    Ditto. That's the ticket. But conjuring up the functional specs
    for an interesting, doable (in this case easily doable) project
    is a skill in itself, in fact a job title in itself. Most entry
    level books I've seen sacrifice the "interesting" in favor of
    the "easily doable", which I guess is a necessary tradeoff.
    Maybe there's some site with a collection of little learning
    projects that's both, though I don't know of one. That would
    be a nice idea in itself, probably largely language agnostic
    (i.e., not C specific).

    > But working at a support role where you have to read lots of code
    > and fix it is even better than that and along with it,
    > you'll have it all.


    That's a different mindset and a somewhat different skill.
    Some people can do one and not the other: some just can't
    seem to get going with nothing but a blank sheet of paper,
    while others can't seem to dive into the middle of a pile
    of existing code. Programmers need both skills in spades,
    but you want to learn (as the op does) with writing your
    own code, expressing your own thinking in your own style.
    So, like "gwowen" first suggested, get yourself a project.
    --
    John Forkosh ( mailto: where j=john and f=forkosh )
    JohnF, Feb 8, 2012
    #18
  19. Sleepy Duke

    Rui Maciel Guest

    Nick Keighley wrote:

    > write lots of code.
    >
    > the best way I found was already knowing anothe couple of programming
    > languages, but this probably doesn't help...


    I would also add participating in public forums dedicated to the programming
    language, such as comp.lang.c, and also forums dedicated to specific
    platforms, such as comp.unix.programmer. Getting our hands dirty may be the
    best learning experience that we can have, but being exposed to the
    experiences that others had/are having will also contributes greatly to our
    own progress.

    Plus, when we stumble on a problem we might benefit from having a community
    willing to help us out on it. Conversely, we may help others with their
    problems, and in the process learn a bit more from it.

    In short, we may do all our learning alone, but being a part of a community
    dedicated to a specific subject also helps a lot.


    Rui Maciel
    Rui Maciel, Feb 8, 2012
    #19
  20. Sleepy Duke

    Jorgen Grahn Guest

    On Sat, 2012-02-04, Malcolm McLean wrote:
    > On Feb 3, 5:24 pm, Sleepy Duke <> wrote:
    >> What are the best methods you all have found for teaching yourselves how to code proficiently in C?
    >>

    > Basically do it.
    >
    > If you're sitting in a bedroom on your own, the most likely thing
    > you'll want to code is a game. So get graphics working as fast as you
    > can. It's harder now than it was to get a simple character-based
    > raster that can be used for moving space invaders round the screen.


    It's still easy on Unix, where you have the curses library.

    {{Unix bigot mode|
    Unix in general makes it easier to write programs which are small and
    have a simple interface, yet are useful. I haven't tried it, but I
    imagine the threshold is much higher on Windows.}}

    /Jorgen

    --
    // Jorgen Grahn <grahn@ Oo o. . .
    \X/ snipabacken.se> O o .
    Jorgen Grahn, Feb 8, 2012
    #20
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ralf W. Grosse-Kunstleve
    Replies:
    16
    Views:
    578
    Lonnie Princehouse
    Jul 11, 2005
  2. Ralf W. Grosse-Kunstleve
    Replies:
    18
    Views:
    592
    Bengt Richter
    Jul 11, 2005
  3. Ralf W. Grosse-Kunstleve
    Replies:
    2
    Views:
    399
    Dan Sommers
    Jul 12, 2005
  4. falcon
    Replies:
    0
    Views:
    372
    falcon
    Jul 31, 2005
  5. fasisi
    Replies:
    26
    Views:
    645
    Mark Space
    Dec 6, 2007
Loading...

Share This Page