c-programming

Simple C programs
git clone git://git.laack.co/c-programming.git
Log | Files | Refs

line-count.c (209B)


      1 #include <stdio.h>
      2 int main(){
      3     int c;
      4     long count;
      5     while((c = getchar()) != EOF){
      6         if(c == '\n'){
      7             count += 1;
      8         }
      9     }
     10     printf("\nThere were %ld lines\n", count + 1);
     11 }