Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

k&r

Name: Anonymous 2010-09-02 0:50

should i read k&r

Name: Anonymous 2010-09-02 22:08

>>20
I'm guessing you guys downloaded the shitty typed-up-in-WOrd version instead of the LaTeX typeset one or the scan.

I downloaded 3 versions of the 2nd edition and all 3 of them have the same errors. Just came across another one. Chapter 1.5.4, the wc example:

#include <stdio.h>

#define IN 1 /* inside a word */
#define OUT 0 /* outside a word */

/* count lines, words, and characters in input */
main()
{
    int c, nl, nw, nc, state;
    state = OUT;
    nl = nw = nc = 0;
    while ((c = getchar()) != EOF) {
            ++nc;
        if (c == '\n')
            ++nl;
        if (c == ' ' || c == '\n' || c = '\t') // Should be c == '\t'
            state = OUT;
        else if (state == OUT) {
            state = IN;
            ++nw;
        }
    }
    printf("%d %d %d\n", nl, nw, nc);

}


Can someone with a hard copy confirm this?

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List