BSD 4_3_Tahoe release
[unix-history] / usr / lib / learn / C / L33.1a
CommitLineData
d6c1f319
C
1#print
2Write a main program which counts the number of command-line arguments
3it has which begin with the letter 'b'. Print the
4result in decimal. Compile and test it as usual.
5Then type "ready".
6#user
7a.out abc bcd efg rpq b bbvd >xxx
8grep 3 xxx >/dev/null
9#succeed
10/* a possible solution */
11main(argc, argv)
12char *argv[];
13{
14 int i, k;
15
16 for(i=k=0; i<argc; i++)
17 if (argv[i][0] == 'b')
18 k++;
19 printf("%d\n", k);
20}
21#log
22#next
2337.1a 10