Annotation of 43BSDTahoe/usr.lib/learn/C/L33.1a, revision 1.1

1.1     ! root        1: #print
        !             2: Write a main program which counts the number of command-line arguments
        !             3: it has which begin with the letter 'b'.  Print the
        !             4: result in decimal.  Compile and test it as usual.
        !             5: Then type "ready".
        !             6: #user
        !             7: a.out abc bcd efg rpq b bbvd  >xxx
        !             8: grep 3 xxx >/dev/null
        !             9: #succeed
        !            10: /*  a possible solution */
        !            11: main(argc, argv)
        !            12: char *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
        !            23: 37.1a 10

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.