Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!burl!ulysses!gamma!epsilon!zeta!sabre!petrus!scherzo!allegra!princeton!caip!seismo!umcp-cs!aplcen!aplvax!pmg From: pmg@aplvax.UUCP (P. Michael Guba) Newsgroups: net.lang.c Subject: Re: Switch case common code Message-ID: <237@aplvax.UUCP> Date: Wed, 11-Jun-86 09:27:02 EDT Article-I.D.: aplvax.237 Posted: Wed Jun 11 09:27:02 1986 Date-Received: Sun, 15-Jun-86 07:12:45 EDT References: <605@cisden.UUCP> <134@danews.UUCP> Reply-To: pmg@aplvax.UUCP (P. Michael Guba) Followup-To: net.lang.c Distribution: net Organization: JHU/Applied Physics Laboratory Lines: 21 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