#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);
}

/*
Discuss:

- counting lines = counting newline characters
- == (equality operator), no warning/error if use = instead!
- character constants
    integer value equal to numerical value in machine's 
    character set (e.g. ASCII)
    if (c == 10) ... (same thing...)

Exercises 1-8, 1-9, 1-10 (page 20)

*/
