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

C newbie questions?

Name: Anonymous 2013-09-30 11:14

ive been trying to learn c. in this program and a few others the app waits for EOF and i dunno how to send EOF on a terminal to make it work. i tried ^C and "." help plz?
#include <stdio.h>
/* count lines in input */

main()
{

    int c, nl;
    nl = 0;
    while ((c = getchar()) != EOF)
        if (c == '\n')
            ++nl;
    printf("%d\n", nl);
}

Name: Anonymous 2013-09-30 12:59

If it ain't LISP, it's shit. Commit suicide.

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