You are switching on the address of a string. If you where to do switch
(*string) you would switch on the first character in the string. You cant
(as far as Im aware) switch on a whole string, you would have to use string
compare code as C cannot do string comparisons without using libs.
Rik
> -----Original Message-----
> From: David Leland [SMTP:[EMAIL PROTECTED]]
> Sent: 13 February 2001 16:00
> To: Palm Developer Forum
> Subject: switch/case question
>
> I'm sorry to ask such a basic C question but my reference books are all at
> home. Why doesn't the following work.
>
> Char * string;
> .
> . // string copy here
> .
> switch(string)
> {
> case 'Some value':
> // do something here
> break;
> .
> .
> .
> }
>
> I receive the following compile error
>
> Error : illegal operand 'char *'
> PlugIn.c line 718 switch(string)
>
> Error : illegal character constant
> PlugIn.c line 720 case 'Some value':
>
> It appears that switch/case only allow 1 character. Is there another form
> of switch/case (other than using "if") for string values?
>
> Dave
>
>
>
> --
> For information on using the Palm Developer Forums, or to unsubscribe,
> please see http://www.palmos.com/dev/tech/support/forums/
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/