Switch case common code

P. Michael Guba pmg at aplvax.UUCP
Wed Jun 11 23:27:02 AEST 1986


Maybe I missed some restrictions someone put
on how this problem can be solved. 
If not, I suggest putting the common code into
a function.  This seems to be the cleanest solution
and it provides a lot more flexibility.

	switch(char) {
	case 'a':
		. . .
		common_code();
	case 'b':
		common_code();
		. . .
	case 'c':
		. . .
	}
-- 
P. Michael Guba			...seismo!umcp-cs!aplvax!pmg
JHU/Applied Physics Lab
Johns Hopkins Road
Laurel, Maryland 20707		(301) 953-6829



More information about the Comp.lang.c mailing list