Re: [CODE] Two lines trying to define a character

From: Marc Gale (m.gale@HUGH.BGC.AC.UK)
Date: 12/18/97


> Anyone have any clue to why this gives a parse error (the lines with the
> arrow produce the errors):
>
> switch(blah) {
>    case CASE_1:
> ->   char blah = "stupid man";
>      break;
>    case CASE_2:
> ->   char blah = "stupid man 2";
>      break;
>    default:
>      log("I am a flying elephant.");
>      break;
>  }
>
Yes, you cannot make a char value equal to a string, what you have to
do (in my experience anyway) is to use a strcpy function to copy the
string into the char variable.

Hope that helps.

Marc


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/08/00 PST