C programming prerequisites

Discussion in 'C Programming' started by David Delony, Mar 2, 2007.

  1. David Delony

    David Delony Guest

    I've hacked on shell and Perl and now I want to get seriously into
    C. I got bogged down in K & R, but I realized that I need to know more
    about the low-level computing stuff. I'd like some pointers (no pun
    intended) to further information.

    --
    There's no place like ~!
    David Delony
    E-mail:
    Blog: http://ddelony.livejournal.com
    David Delony, Mar 2, 2007
    #1
    1. Advertising

  2. David Delony

    user923005 Guest

    On Mar 1, 4:51 pm, David Delony <> wrote:
    > I've hacked on shell and Perl and now I want to get seriously into
    > C. I got bogged down in K & R, but I realized that I need to know more
    > about the low-level computing stuff. I'd like some pointers (no pun
    > intended) to further information.


    C-FAQ:
    http://c-faq.com/

    Tutorials from the horse's mouth:
    http://www.lysator.liu.se/c/bwk-tutor.html
    http://cm.bell-labs.com/cm/cs/who/dmr/ctut.pdf

    Tutorials from Steve Summit:
    http://www.eskimo.com/~scs/cclass/
    http://www.eskimo.com/~scs/cclass/notes/top.html

    Tom Torf's Tutorial:
    http://cprog.tomsweb.net/cintro.html

    After reading the tutorials and trying out the exercises in them, read
    K&R2 again.
    user923005, Mar 2, 2007
    #2
    1. Advertising

  3. David Delony

    Guest

    Assignment operators [was: C programming prerequisites]

    On Mar 2, 6:26 am, "user923005" <> wrote:
    <snip>
    > Tutorials from the horse's mouth:

    <snip>
    http://cm.bell-labs.com/cm/cs/who/dmr/ctut.pdf

    I found something strange in the above tutorial:

    <Quote from ctut.pdf>
    25. Assignment Operators
    An unusual feature of C is that the normal binary operators like '+',
    '-', etc. can be combined with
    the assignment operator '=' to form new assignment operators. For
    example,
    x =- 10;
    uses the assignment operator '=-' to decrement x by 10, and
    x =& 0177
    forms the AND of x and 0177. This convention is a useful notational
    shortcut, particularly if x is a complicated
    expression. The classic example is summing an array:
    for( sum=i=0; i<n; i++ )
    C Tutorial - 23 -
    sum =+ array;
    But the spaces around the operator are critical! For instance,
    x = -10;
    sets x to -10, while
    x =- 10;
    subtracts 10 from x. When no space is present,
    x=-10;
    also decreases x by 10.
    </Quote from ctut.pdf>

    As far as I know,
    x = -10;
    x =- 10;
    are equivalent. And for decrement, we use -= operator(not =-).
    Was this something which was only in previous C standard or only in
    K&R C?
    , Mar 2, 2007
    #3
  4. Re: Assignment operators [was: C programming prerequisites]

    said:

    > On Mar 2, 6:26 am, "user923005" <> wrote:
    > <snip>
    >> Tutorials from the horse's mouth:

    > <snip>
    > http://cm.bell-labs.com/cm/cs/who/dmr/ctut.pdf
    >
    > I found something strange in the above tutorial:


    Hardly surprising - it's ancient history, and advertised as such. I
    cannot see why user923005 is recommending it so highly to a newbie. It
    is a very important document, yes - but important to whom? If you're
    interested in learning C, Just Don't Go There. If you're interested in
    the /history/ of C, however, then yes, by all means lap it up.

    --
    Richard Heathfield
    "Usenet is a strange place" - dmr 29/7/1999
    http://www.cpax.org.uk
    email: rjh at the above domain, - www.
    Richard Heathfield, Mar 2, 2007
    #4
  5. David Delony said:

    > I've hacked on shell and Perl and now I want to get seriously into
    > C. I got bogged down in K & R, but I realized that I need to know more
    > about the low-level computing stuff. I'd like some pointers (no pun
    > intended) to further information.


    Lots of useful information here:

    http://www.cpax.org.uk/prg/portable/c/resources.php

    --
    Richard Heathfield
    "Usenet is a strange place" - dmr 29/7/1999
    http://www.cpax.org.uk
    email: rjh at the above domain, - www.
    Richard Heathfield, Mar 2, 2007
    #5
  6. Re: Assignment operators [was: C programming prerequisites]

    writes:
    > On Mar 2, 6:26 am, "user923005" <> wrote:
    > <snip>
    >> Tutorials from the horse's mouth:

    > <snip>
    > http://cm.bell-labs.com/cm/cs/who/dmr/ctut.pdf
    >
    > I found something strange in the above tutorial:
    >
    > <Quote from ctut.pdf>
    > 25. Assignment Operators
    > An unusual feature of C is that the normal binary operators like '+',
    > '-', etc. can be combined with
    > the assignment operator '=' to form new assignment operators. For
    > example,
    > x =- 10;
    > uses the assignment operator '=-' to decrement x by 10, and
    > x =& 0177
    > forms the AND of x and 0177.

    [...]
    > As far as I know,
    > x = -10;
    > x =- 10;
    > are equivalent. And for decrement, we use -= operator(not =-).
    > Was this something which was only in previous C standard or only in
    > K&R C?


    That's a *very* old tutorial, probably from the mid-1970s. The
    language changed substantially even between then an K&R1. Yes, very
    old versions of the language used "=-" where the modern language uses
    "-=". It's historically fascinating, but not a good way to learn the
    language as it exists now.

    Some interesting oddities:

    Here's the first code sample:

    main( ) {
    printf("hello, world");
    }

    See what's missing? I mean apart from "#include <stdio.h>", and
    "int", and "return 0;"? There's no "\n" in the string literal.

    No unsigned, no short, no long.

    "Variable names have one to eight characters ..."

    The language had octal constants, but no hexadecimal constants
    (perhaps the PDP-11 influence).

    getchar() returned '\0', not EOF, on reaching end-of-file.

    Initializations didn't use "=":
    int x 0;

    Macros, but no function-like macros.

    A suggested use of "goto" is for a long loop, where while(1) "would be
    too extended":

    mainloop:
    ...
    goto mainloop;

    --
    Keith Thompson (The_Other_Keith) <http://www.ghoti.net/~kst>
    San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
    "We must do something. This is something. Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"
    Keith Thompson, Mar 2, 2007
    #6
    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. Ridvan

    .net environment - prerequisites

    Ridvan, Sep 15, 2006, in forum: ASP .Net
    Replies:
    8
    Views:
    338
    Ridvan
    Sep 15, 2006
  2. broli

    prerequisites to learning C

    broli, Mar 12, 2008, in forum: C Programming
    Replies:
    3
    Views:
    299
  3. Wolfgang Nádasi-Donner

    Build one-click-installer version prerequisites

    Wolfgang Nádasi-Donner, Jul 23, 2005, in forum: Ruby
    Replies:
    6
    Views:
    95
    Wolfgang Nádasi-Donner
    Jul 25, 2005
  4. Martin Honermeyer

    Rake: multiple prerequisites in rule?

    Martin Honermeyer, Sep 2, 2005, in forum: Ruby
    Replies:
    6
    Views:
    161
    Martin Honermeyer
    Sep 6, 2005
  5. Joel VanderWerf

    rake rules with multiple prerequisites

    Joel VanderWerf, Mar 19, 2006, in forum: Ruby
    Replies:
    8
    Views:
    121
    Joel VanderWerf
    Mar 21, 2006
Loading...

Share This Page