*wall W should be wall* W, same for entity.
Also, what's with the case outside a switch?
Another problem both codes have is the expression a < b < c. It wont work. Operators are evaluated one at a time, so this is equal to (a < b) < c. a < b can be only true or false, so you're comparing 1 or 0 to c.
This should be a < b && b < c instead.
Also, main() should be an int function and return 0.
Also, in the first example, if would be much more appropriate than a switch, since there can be only two values.
Well, your case doesn't have a break.. (so all cases will be evaluated)
Other than that, no. Putting things in a function should not make any difference here.