C examples for Data Type:char
Counts input lines from user input
#include <stdio.h> int main(){ /*from w ww . j av a 2 s . co m*/ int c, nl = 0; while ((c = getchar()) != EOF) { if (c == '\n') ++nl; } printf("%d\n", nl); }