>I'm just wondering if this is ever going to be a legal statement.
It never has been and never will be. Try this instead:
Or better yet, write a function to validate key and use the return value in your loop condition for readability and maintenance purposes:
} while ( key != '1' && key != '2' && key != '3' );
>Would it be possible to return both xval and yval at the end of the function
} while ( !keyCheck ( key ) );
Yes, but it would take a bit of fiddling. A better way would be to store both xval and yval in a struct and then return that struct so that both values can be easily returned AND they remain bound to each other as it should be: