File:  [CSRG BSD Unix] / 43BSDReno / usr.bin / learn / learnlib / C / L33.1a
Revision 1.1: download - view: text, annotated - select for diffs
Tue Apr 24 16:12:56 2018 UTC (8 years, 1 month ago) by root
CVS tags: MAIN, HEAD
Initial revision

#print
Write a main program which counts the number of command-line arguments
it has which begin with the letter 'b'.  Print the
result in decimal.  Compile and test it as usual.
Then type "ready".
#user
a.out abc bcd efg rpq b bbvd  >xxx
grep 3 xxx >/dev/null
#succeed
/*  a possible solution */
main(argc, argv)
char *argv[];
{
	int i, k;

	for(i=k=0; i<argc; i++)
		if (argv[i][0] == 'b')
			k++;
	printf("%d\n", k);
}
#log
#next
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.