Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!usc!cs.utexas.edu!romp!auschs!d75!advent.uucp!thomas From: thomas@advent.uucp Newsgroups: comp.lang.c Subject: C puzzle Message-ID: <4007@d75.UUCP> Date: 17 Jun 91 22:44:11 GMT Sender: news@d75.UUCP Reply-To: thomas@advent.uucp () Organization: IBM AWD, Austin, TX Lines: 25 The following is an interesting 'C' puzzle. Consider this typical switch statement, typical except that 'default' is misspelled 'defalut'! What is interesting is that any C compiler will not and should not give you a syntax error. Why? switch (cmd) { case GO: ... break; case STOP: ... break; defalut: printf ("Unknown command\n"); break; } (Hint: It is bad programming practice to jump into the middle of a switch statement.) thomas