Breaking out of several nested loops

Tom Duff td at alice.UUCP
Wed Oct 3 14:43:51 AEST 1984


The correct way to break out of multiply nested control constructs (using the
example in the referenced article) without using 3 separate boolean flags is:

	i=1;
	while(...){
		...
		for(...;...;...){
			...
			switch(...){
				...
				goto Out;
			}
		}
	}
Out:	i=2;



More information about the Comp.lang.c mailing list