1
0
mirror of https://github.com/krislamo/knrc.git synced 2024-11-10 00:30:35 +00:00

Character counting example

This commit is contained in:
Kris Lamoureux 2021-11-05 21:29:39 -04:00
parent 979467565f
commit 72093b7232
Signed by: kris
GPG Key ID: 3EDA9C3441EDA925
2 changed files with 15 additions and 1 deletions

11
05-char-counting.c Normal file
View File

@ -0,0 +1,11 @@
#include <stdio.h>
int main()
{
long nc;
nc = 0;
while (getchar() != EOF)
++nc;
printf("%ld\n", nc);
}

View File

@ -1,4 +1,4 @@
all: hello mathvars c2f input all: hello mathvars c2f input count
hello: 01-hello-world.c hello: 01-hello-world.c
gcc -o ./bin/01-helloworld 01-hello-world.c gcc -o ./bin/01-helloworld 01-hello-world.c
@ -12,5 +12,8 @@ c2f: 03-celsius-to-fahrenheit.c
input: 04-file-copying.c input: 04-file-copying.c
gcc -o ./bin/04-input 04-file-copying.c gcc -o ./bin/04-input 04-file-copying.c
count: 05-char-counting.c
gcc -o ./bin/05-count 05-char-counting.c
clean: clean:
$(RM) ./bin/*-* $(RM) ./bin/*-*