Language
C
Compiler
gcc 12.1.0
Options
Warnings
C11
no pedantic
#include <stdio.h>
/* count lines in input */
int main() {
int c, nl, t, s;
nl = 0;
t = 0;
s = 0;
while ((c = getchar()) != EOF) {
if (c == '\n') {
++nl;
}
if (c == '\t') {
++t;
}
if (c == ' ') {
++s;
}
}
printf("%d new lines, %d tabs, %d spaces\n", nl, t, s);
}
fasee wer wer w
werw roawe ajwef
rfa wejrfeaweaa
$ gcc prog.c -Wall -Wextra -std=c11
3 new lines, 0 tabs, 6 spaces
Exit Code:
0