相关疑难解决方法(0)

这个1988 C代码有什么问题?

我正在尝试编写"The C Programming Language"(K&R)一书中的这段代码.它是UNIX程序的一个简单版本wc:

#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')
            state = OUT; …
Run Code Online (Sandbox Code Playgroud)

c

95
推荐指数
7
解决办法
7643
查看次数

标签 统计

c ×1