You cannot define a variable inside a switch statement, basically speaking. The compiler complains because the second case statement skips the first definition. However, both definitions are in the same "name space" and the problem is that the same variable can be defined in two different ways. The case statement is a remnant of old GOTO statements, and c doesn't like statements that switch program control but not namespace. To fix it simply define "char blah" before the switch statement, which from your example looks like what you meant to do anyways. Assuming that you want output the "char blah" after the switch, the variable would not be defined anymore after the switch exited. On Wed, 17 Dec 1997, Chuck Reed wrote: > 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; > } > Jonathan Branam jpbranam@indiana.edu & roadkill@writeme.com (both forwarded to the same place) +------------------------------------------------------------+ | 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