Re: Multiple Case Values

From: Bryan Donlan (bdonlan@maine.rr.com)
Date: 02/11/02


On Monday 11 February 2002 01:39 am, you wrote:
> From: Bejhan Jetha <nhlstar6@YAHOO.COM>
>
> >I know C doesn't support multiple case values but is there another way to
> >make it so you can still have two letters without using case values?
>
> you mean like
>
> int whichway(char *dir);
>   {
>     switch(dir)
>       {
>         case "N":
>           return 0;
>         case "NE":
>           return 1;
>         case "E":
>           return 2;
>
> ::snip::
>
>       }
>     return -EError;
>   }


I belive case would compare pointers, and almost certainly not match
anything. You'd have to do multiple strcmps in an if-elseif-else construct.

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   | Newbie List:  http://groups.yahoo.com/group/circle-newbies/   |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 06/25/03 PDT