Path: utzoo!utgpu!attcan!uunet!lll-winken!lll-tis!ames!haven!umd5!dzoey From: dzoey@umd5.umd.edu (Joe Herman) Newsgroups: comp.lang.c Subject: Why is switch (ptr) illegal (or how to pointers differ from scalers)? Message-ID: <4347@umd5.umd.edu> Date: 16 Dec 88 00:00:45 GMT Organization: University of Maryland, College Park Lines: 41 If I have a structure tag: typdef struct foo { int key; int pitch; } NOTE; and I declare the following structures: NOTE do, re, mi; and the pointer: NOTE *scale; Why can I not do: switch (scale) { case &do: do_something (scale); break; case &re: do_somethingelse (scale); break } etc. The compiler I used says that scale isn't a scaler and that do, mi and re are address expressions and can't be used in this context. As a test, I casted scale to an int and it stopped complaining about scale, but still complained about the case values even thought they evaluate to constant values (I'm not sure this matters). So, why is it important that scale be a scaler? Joe Herman dzoey@terminus.umd.edu -- "Everything is wonderful until you know something about it."