Put your code... (was Re: gotos

kenny at uiucdcsb.cs.uiuc.edu kenny at uiucdcsb.cs.uiuc.edu
Thu Apr 28 04:32:00 AEST 1988


I made an error in Part 2 of my recent posting on this subject.  I
left out the ungetc() (which is the key to the whole procedure!) in
the sample C version of Knuth's Example 5.

The code to handle '/' should look like:

case '/':
	if ((c = getchar ()) == '/') {
		putchar ('\n');
		column = 0;
		}
	else {
		ungetc (c);
		column = tabulate (column);
		}
	break;

It beats me how I let that particular gaffe slip through, but I humbly
and contritely apologize to anyone that I confused with it.

Kevin Kenny			UUCP: {ihnp4,pur-ee,convex}!uiucdcs!kenny
Department of Computer Science	ARPA: kenny at B.CS.UIUC.EDU (kenny at UIUC.ARPA)
University of Illinois		CSNET: kenny at UIUC.CSNET
1304 W. Springfield Ave.
Urbana, Illinois, 61801		Voice: (217) 333-6680



More information about the Comp.lang.c mailing list